lib/client: reset state when websocket is closed

This commit is contained in:
Simon Ser 2021-03-03 09:36:48 +01:00
parent 80e0175d36
commit 8a5fa4d5c2

View file

@ -74,6 +74,10 @@ export default class Client extends EventTarget {
console.log("Connection closed");
this.ws = null;
this.setStatus(Client.Status.DISCONNECTED);
this.availableCaps = {};
this.enabledCaps = {};
this.batches = new Map();
this.pendingHistory = Promise.resolve(null);
if (this.autoReconnect) {
console.info("Reconnecting to server in " + RECONNECT_DELAY_SEC + " seconds");