Make websocket retry longer
This commit is contained in:
parent
ce04b268c3
commit
ea2c7d2f36
1 changed files with 3 additions and 1 deletions
|
@ -7,6 +7,7 @@ function EventReceiver(websocket, poller, channels, last_msg, onmessage) {
|
||||||
if (onmessage)
|
if (onmessage)
|
||||||
this.onmessage = onmessage;
|
this.onmessage = onmessage;
|
||||||
var receiver = this;
|
var receiver = this;
|
||||||
|
var time_retry = 1000;
|
||||||
|
|
||||||
function init_poll() {
|
function init_poll() {
|
||||||
function long_poll() {
|
function long_poll() {
|
||||||
|
@ -62,7 +63,8 @@ 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(connect, 1000);
|
setTimeout(connect, time_retry);
|
||||||
|
time_retry += 2000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue