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',