frontend: fix reconnect timeout
This commit is contained in:
parent
e329c64eb7
commit
fdbf6c9839
1 changed files with 5 additions and 2 deletions
|
@ -33,7 +33,6 @@ export default {
|
||||||
if (this.reconnectTimeout) {
|
if (this.reconnectTimeout) {
|
||||||
clearTimeout(this.reconnectTimeout);
|
clearTimeout(this.reconnectTimeout);
|
||||||
}
|
}
|
||||||
this.reconnectDelay = 400;
|
|
||||||
};
|
};
|
||||||
this.ws.onmessage = (event) => {
|
this.ws.onmessage = (event) => {
|
||||||
const payload = JSON.parse(event.data);
|
const payload = JSON.parse(event.data);
|
||||||
|
@ -56,12 +55,16 @@ export default {
|
||||||
case GatewayPayloadType.Ready: {
|
case GatewayPayloadType.Ready: {
|
||||||
this.user = payload.d.user;
|
this.user = payload.d.user;
|
||||||
this.channels = payload.d.channels;
|
this.channels = payload.d.channels;
|
||||||
|
|
||||||
|
this.reconnectDelay = 400;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.ws.onclose = () => {
|
this.ws.onclose = () => {
|
||||||
|
if (this.reconnectDelay < 60000) {
|
||||||
this.reconnectDelay *= 2;
|
this.reconnectDelay *= 2;
|
||||||
|
}
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
this.user = null;
|
this.user = null;
|
||||||
this.channels = null;
|
this.channels = null;
|
||||||
|
|
Loading…
Reference in a new issue