* Cleanup

This commit is contained in:
Daniel Legt 2022-06-07 01:44:48 +03:00
parent 177ab62720
commit 5518103575
1 changed files with 7 additions and 2 deletions

View File

@ -51,9 +51,14 @@ class PadSocket {
updateStatus(`Established`, `text-success`);
}
function onFail() {
updateStatus(`Connection Failed`, `text-dangerous`);
setTimeout( connectSocket , 1000);
}
// Try and reconnect on failure
ws.onclose = connectSocket;
ws.onerror = connectSocket;
ws.onclose = onFail;
ws.onerror = onFail;
// Assign the websocket
this.ws = ws;