From d6d9c63b3db6ce61e518a929b88dd7fc48a59ceb Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Sat, 9 May 2026 14:38:52 +0200 Subject: [PATCH] fix: disconnection issue by adding a persistent ping (#121) Fixes the frequent disconnection issue, by adding a ping. The "version" call works without authentication and is lightweight. Passing the "true" flag, prevents delivery of cached results. This keeps the socket always connected. Feature may be removed in the future if the upstream library has a proper fix for the issue. Reviewed-on: https://gitea.t000-n.de/t.behrendt/ts3gotify/pulls/121 Co-authored-by: Timo Behrendt Co-committed-by: Timo Behrendt --- src/ts3gotify.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ts3gotify.ts b/src/ts3gotify.ts index babd587..a5dc3f5 100644 --- a/src/ts3gotify.ts +++ b/src/ts3gotify.ts @@ -43,7 +43,8 @@ export function ts3gotifyFactory( ts3Client: TeamSpeak, gotifyClient: Gotify, gotifyConfig: GotifyConfig, - logger: Logger + logger: Logger, + pingInterval = 2_500 ) { let reconnectInProgress = false; @@ -108,6 +109,8 @@ export function ts3gotifyFactory( } } + setInterval(() => ts3Client.version(true), pingInterval); + ts3Client.on("close", async () => { await reconnectWithBackoff(); });