static: backoff retrying to connect to ws
This commit is contained in:
parent
89400b4ea4
commit
a91d0ddc6c
2
passbook/static/static/dist/main.js
vendored
2
passbook/static/static/dist/main.js
vendored
File diff suppressed because one or more lines are too long
2
passbook/static/static/dist/main.js.map
vendored
2
passbook/static/static/dist/main.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -27,6 +27,8 @@ export class Messages extends LitElement {
|
|||
|
||||
messageSocket?: WebSocket;
|
||||
|
||||
retryDelay: number = 200;
|
||||
|
||||
createRenderRoot() {
|
||||
return this;
|
||||
}
|
||||
|
@ -47,9 +49,10 @@ export class Messages extends LitElement {
|
|||
this.messageSocket.addEventListener("close", (e) => {
|
||||
console.debug(`passbook/messages: closed ws connection: ${e}`);
|
||||
setTimeout(() => {
|
||||
console.debug(`passbook/messages: reconnecting ws`);
|
||||
console.debug(`passbook/messages: reconnecting ws in ${this.retryDelay}`);
|
||||
this.connect();
|
||||
}, 1000);
|
||||
}, this.retryDelay);
|
||||
this.retryDelay = this.retryDelay * 2;
|
||||
});
|
||||
this.messageSocket.addEventListener("message", (e) => {
|
||||
const container = <HTMLElement>(
|
||||
|
|
Reference in a new issue