From d71227094664e3fc73ddd1bb3994b47559434fcd Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Fri, 8 Nov 2019 18:48:39 +0100 Subject: [PATCH] fix(core): update --- ts/smartsocket.classes.smartsocketclient.ts | 5 +++++ ts/smartsocket.classes.socketconnection.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ts/smartsocket.classes.smartsocketclient.ts b/ts/smartsocket.classes.smartsocketclient.ts index 3bdbe41..b5460a7 100644 --- a/ts/smartsocket.classes.smartsocketclient.ts +++ b/ts/smartsocket.classes.smartsocketclient.ts @@ -112,6 +112,11 @@ export class SmartsocketClient { }); + // handle connection + this.socketConnection.socket.on('connect', async () => { + this.updateStatus('connected'); + }); + // handle disconnection and errors this.socketConnection.socket.on('disconnect', async () => { await this.disconnect(); diff --git a/ts/smartsocket.classes.socketconnection.ts b/ts/smartsocket.classes.socketconnection.ts index 6e7f4cd..5cbd21c 100644 --- a/ts/smartsocket.classes.socketconnection.ts +++ b/ts/smartsocket.classes.socketconnection.ts @@ -68,6 +68,11 @@ export class SocketConnection { // standard behaviour that is always true allSocketConnections.add(this); + + // handle connection + this.socket.on('connect', async () => { + this.updateStatus('connected'); + }); this.socket.on('disconnect', async () => { plugins.smartlog.defaultLogger.log( 'info',