Try fixing ws

This commit is contained in:
cuom1999 2022-05-18 13:50:18 -05:00
parent 088d78d762
commit ac0b7afc1a

View file

@ -35,6 +35,7 @@ function EventReceiver(websocket, poller, channels, last_msg, onmessage) {
this.onwsclose = null;
if (window.WebSocket) {
function connect() {
this.websocket = new WebSocket(websocket);
var timeout = setTimeout(function () {
receiver.websocket.close();
@ -61,11 +62,11 @@ function EventReceiver(websocket, poller, channels, last_msg, onmessage) {
if (event.code != 1000 && receiver.onwsclose !== null)
receiver.onwsclose(event);
if (event.code == 1006) {
setTimeout(function() {
setTimeout(connect, 1000);
}
}
}
connect();
}, 1000);
}
}
} else {
this.websocket = null;
init_poll();