From 80196093a40a38222452d1da2604e42d5ec93d40 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Mar 2019 11:59:33 -0400 Subject: [PATCH] Changing disconnect connection check to websocket open status instead of peripheral connection. --- src/io/ble.js | 2 +- src/io/bt.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/ble.js b/src/io/ble.js index 8fa21de2e..c52e069e4 100644 --- a/src/io/ble.js +++ b/src/io/ble.js @@ -73,7 +73,7 @@ class BLE extends JSONRPCWebSocket { * Close the websocket. */ disconnect () { - if (!this._connected) return; + if (this._ws.readyState !== this._ws.OPEN) return; this._ws.close(); this._connected = false; diff --git a/src/io/bt.js b/src/io/bt.js index 455684a2a..1770ec751 100644 --- a/src/io/bt.js +++ b/src/io/bt.js @@ -75,7 +75,7 @@ class BT extends JSONRPCWebSocket { * Close the websocket. */ disconnect () { - if (!this._connected) return; + if (this._ws.readyState !== this._ws.OPEN) return; this._ws.close(); this._connected = false;