Try fixing ws
This commit is contained in:
parent
088d78d762
commit
ac0b7afc1a
1 changed files with 30 additions and 29 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue