[refactor] add setTimeout before reconnect

This commit is contained in:
Janis
2023-06-28 18:48:19 +02:00
parent 7d2409f6f4
commit 1bd6e3400b

View File

@@ -30,6 +30,7 @@ export class TS5Connection {
}
reconnect() {
console.log("Reconnecting...")
this.ws.close();
this.ws = new WebSocket(`ws://localhost:${this.remoteAppPort}`);
@@ -74,7 +75,9 @@ export class TS5Connection {
localStorage.removeItem("apiKey");
}
this.reconnect();
setTimeout(() => {
this.reconnect();
}, 2000);
};
// Handle messages received from TS5 client