More solutions for WS reconnect on unstable connection

This commit is contained in:
Amateur Audio Dude
2024-10-01 23:38:57 +10:00
committed by GitHub
parent 9591c7e51a
commit 988e2739a7
+1 -1
View File
@@ -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;