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;
|
this.onwsclose = null;
|
||||||
if (window.WebSocket) {
|
if (window.WebSocket) {
|
||||||
|
function connect() {
|
||||||
this.websocket = new WebSocket(websocket);
|
this.websocket = new WebSocket(websocket);
|
||||||
var timeout = setTimeout(function () {
|
var timeout = setTimeout(function () {
|
||||||
receiver.websocket.close();
|
receiver.websocket.close();
|
||||||
|
@ -61,11 +62,11 @@ function EventReceiver(websocket, poller, channels, last_msg, onmessage) {
|
||||||
if (event.code != 1000 && receiver.onwsclose !== null)
|
if (event.code != 1000 && receiver.onwsclose !== null)
|
||||||
receiver.onwsclose(event);
|
receiver.onwsclose(event);
|
||||||
if (event.code == 1006) {
|
if (event.code == 1006) {
|
||||||
setTimeout(function() {
|
setTimeout(connect, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
connect();
|
connect();
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.websocket = null;
|
this.websocket = null;
|
||||||
init_poll();
|
init_poll();
|
||||||
|
|
Loading…
Reference in a new issue