diff --git a/lib/websocket-tracker.js b/lib/websocket-tracker.js index 249786f..b5233b4 100644 --- a/lib/websocket-tracker.js +++ b/lib/websocket-tracker.js @@ -233,10 +233,13 @@ WebSocketTracker.prototype._onSocketError = function (err) { WebSocketTracker.prototype._startReconnectTimer = function () { var self = this var ms = Math.floor(Math.random() * RECONNECT_VARIANCE) + RECONNECT_MINIMUM - setTimeout(function () { + + var reconnectTimer = setTimeout(function () { self.destroyed = false self._openSocket() }, ms) + if (reconnectTimer.unref) reconnectTimer.unref() + debug('reconnecting socket in %s ms', ms) }