fix(socketio): Re-try thrice before trying to reconnect

Set reconnectionAttempts to 3. If the server doesn't want to connect
with the respective client (invalid origin, no cookie or sid transmitted)
or is gone down, socketio client would retry connections indefinitely.
This change limits retrying connection to just thrice every second.
This commit is contained in:
Gavin D'souza 2022-11-14 14:03:25 +05:30
parent c86e1de38a
commit 5210ea593f

View file

@ -17,14 +17,17 @@ frappe.socketio = {
frappe.socketio.socket = io.connect(frappe.socketio.get_host(port), {
secure: true,
withCredentials: true,
reconnectionAttempts: 3,
});
} else if (window.location.protocol == "http:") {
frappe.socketio.socket = io.connect(frappe.socketio.get_host(port), {
withCredentials: true,
reconnectionAttempts: 3,
});
} else if (window.location.protocol == "file:") {
frappe.socketio.socket = io.connect(window.localStorage.server, {
withCredentials: true,
reconnectionAttempts: 3,
});
}