From 988e2739a70470af3956d1135722f03663a52688 Mon Sep 17 00:00:00 2001 From: Amateur Audio Dude <168192910+AmateurAudioDude@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:38:57 +1000 Subject: [PATCH] More solutions for WS reconnect on unstable connection --- web/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/main.js b/web/js/main.js index 22bb828..a008dc8 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -290,7 +290,7 @@ function sendPingRequest() { console.warn('Ping request failed'); $('#current-ping').text(`Ping: unknown`); if (!pingTimeLimit) { // Force reconnection as WebSocket could be unresponsive even though it's reported as OPEN - window.socket.close(1000, 'Normal closure'); + if (messageLength === 0) window.socket.close(1000, 'Normal closure'); if (connectionLost) sendToast('warning', 'Connection lost', 'Attempting to reconnect...', false, false); console.log("Reconnecting due to high ping..."); pingTimeLimit = true;