From af6a6e647bd7474b0efc8885f92a49516ca48a02 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Mon, 5 Oct 2020 21:15:10 +0100 Subject: [PATCH] fix: ws handle possible timeout --- lib/websocket-client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/websocket-client.js b/lib/websocket-client.js index 9e7672f..36aeee8 100644 --- a/lib/websocket-client.js +++ b/lib/websocket-client.js @@ -62,7 +62,7 @@ module.exports = class WebsocketClient extends EventEmitter { this.logger.info('Closing connection', {category: 'bybit-ws'}); this.readyState = READY_STATE_CLOSING; this._teardown(); - this.ws.close(); + this.ws && this.ws.close(); } async _connect() {