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) {
|
||||
clearTimeout(this.reconnectTimeout);
|
||||
}
|
||||
this.reconnectDelay = 400;
|
||||
};
|
||||
this.ws.onmessage = (event) => {
|
||||
const payload = JSON.parse(event.data);
|
||||
|
@ -56,12 +55,16 @@ export default {
|
|||
case GatewayPayloadType.Ready: {
|
||||
this.user = payload.d.user;
|
||||
this.channels = payload.d.channels;
|
||||
|
||||
this.reconnectDelay = 400;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
this.ws.onclose = () => {
|
||||
this.reconnectDelay *= 2;
|
||||
if (this.reconnectDelay < 60000) {
|
||||
this.reconnectDelay *= 2;
|
||||
}
|
||||
this.authenticated = false;
|
||||
this.user = null;
|
||||
this.channels = null;
|
||||
|
|
Loading…
Reference in a new issue