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: #121 Co-authored-by: Timo Behrendt <t.behrendt@t00n.de> Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #121.
This commit is contained in:
+4
-1
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user