From 0220377a9c4c75ae29e1609f8bb7d2b5c8a9794d Mon Sep 17 00:00:00 2001 From: Timur Sufiev Date: Wed, 19 Dec 2018 16:39:47 +0300 Subject: [PATCH] Reset `forcedClose` flag on socket open Client code may close and then open reconnectingwebsocket - in that case `forcedClose` flag has to be reset, otherwise subsequent disconnects would be treated as forced. --- reconnecting-websocket.js | 1 + 1 file changed, 1 insertion(+) diff --git a/reconnecting-websocket.js b/reconnecting-websocket.js index 0cd4332..ea8b859 100644 --- a/reconnecting-websocket.js +++ b/reconnecting-websocket.js @@ -208,6 +208,7 @@ this.open = function (reconnectAttempt) { ws = new WebSocket(self.url, protocols || []); ws.binaryType = this.binaryType; + forcedClose = false; if (reconnectAttempt) { if (this.maxReconnectAttempts && this.reconnectAttempts > this.maxReconnectAttempts) {