From c5d52013e69fe4486719206d7cd71d5e1d29e91e Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Thu, 20 Jan 2022 18:33:46 +0100 Subject: [PATCH] fix(core): update --- ts/interfaces/connection.ts | 3 ++- ts/smartsocket.classes.smartsocketclient.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ts/interfaces/connection.ts b/ts/interfaces/connection.ts index 728b9e5..e99c826 100644 --- a/ts/interfaces/connection.ts +++ b/ts/interfaces/connection.ts @@ -7,4 +7,5 @@ export type TConnectionStatus = | 'connecting' | 'connected' | 'disconnecting' - | 'disconnected'; + | 'disconnected' + | 'timedOut'; diff --git a/ts/smartsocket.classes.smartsocketclient.ts b/ts/smartsocket.classes.smartsocketclient.ts index cb3fe1d..62e687c 100644 --- a/ts/smartsocket.classes.smartsocketclient.ts +++ b/ts/smartsocket.classes.smartsocketclient.ts @@ -118,6 +118,7 @@ export class SmartsocketClient { const timer = new plugins.smarttime.Timer(5000); timer.start(); timer.completed.then(() => { + this.updateStatus('timedOut'); logger.log('warn', 'connection to server timed out.'); this.disconnect(true); }); @@ -189,7 +190,7 @@ export class SmartsocketClient { /** * disconnect from the server */ - public async disconnect(useAutoconnectSetting = false) { + public async disconnect(useAutoReconnectSetting = false) { if (this.disconnectRunning) { return; } @@ -209,7 +210,7 @@ export class SmartsocketClient { logger.log('warn', `disconnected from server ${this.remoteShortId}`); this.remoteShortId = null; - if (this.autoReconnect && useAutoconnectSetting && this.eventStatus !== 'connecting') { + if (this.autoReconnect && useAutoReconnectSetting && this.eventStatus !== 'connecting') { this.updateStatus('connecting'); await this.tryDebouncedReconnect(); this.disconnectRunning = false;