frontend: fix reconnect timeout

This commit is contained in:
hippoz 2022-04-14 22:04:41 +03:00
parent e329c64eb7
commit fdbf6c9839
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -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 = () => {
if (this.reconnectDelay < 60000) {
this.reconnectDelay *= 2;
}
this.authenticated = false;
this.user = null;
this.channels = null;