You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
More solutions for WS reconnect on unstable connection
This commit is contained in:
committed by
GitHub
parent
d029cbd5ac
commit
9591c7e51a
@@ -291,7 +291,7 @@ function sendPingRequest() {
|
|||||||
$('#current-ping').text(`Ping: unknown`);
|
$('#current-ping').text(`Ping: unknown`);
|
||||||
if (!pingTimeLimit) { // Force reconnection as WebSocket could be unresponsive even though it's reported as OPEN
|
if (!pingTimeLimit) { // Force reconnection as WebSocket could be unresponsive even though it's reported as OPEN
|
||||||
window.socket.close(1000, 'Normal closure');
|
window.socket.close(1000, 'Normal closure');
|
||||||
sendToast('warning', 'Connection lost', 'Attempting to reconnect...', false, false);
|
if (connectionLost) sendToast('warning', 'Connection lost', 'Attempting to reconnect...', false, false);
|
||||||
console.log("Reconnecting due to high ping...");
|
console.log("Reconnecting due to high ping...");
|
||||||
pingTimeLimit = true;
|
pingTimeLimit = true;
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ function sendPingRequest() {
|
|||||||
if (messageCounter === 5) {
|
if (messageCounter === 5) {
|
||||||
messageCounter = 0;
|
messageCounter = 0;
|
||||||
window.socket.close(1000, 'Normal closure');
|
window.socket.close(1000, 'Normal closure');
|
||||||
sendToast('warning', 'Connection lost', 'Attempting to reconnect...', false, false);
|
if (connectionLost) sendToast('warning', 'Connection lost', 'Attempting to reconnect...', false, false);
|
||||||
console.log("Reconnecting due to no data received...");
|
console.log("Reconnecting due to no data received...");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user