diff --git a/lib/client/websocket-tracker.js b/lib/client/websocket-tracker.js index cd51aa5..e24c9a7 100644 --- a/lib/client/websocket-tracker.js +++ b/lib/client/websocket-tracker.js @@ -16,6 +16,7 @@ var Tracker = require('./tracker') var socketPool = {} var RECONNECT_MINIMUM = 15 * 1000 +var RECONNECT_MAXIMUM = 5 * 60 * 1000 var RECONNECT_RETRY = 30 * 1000 var OFFER_TIMEOUT = 50 * 1000 @@ -235,7 +236,7 @@ WebSocketTracker.prototype._onSocketError = function (err) { WebSocketTracker.prototype._startReconnectTimer = function () { var self = this - var ms = RECONNECT_MINIMUM + (self.retries * RECONNECT_RETRY) + var ms = Math.min(RECONNECT_MINIMUM + (self.retries * RECONNECT_RETRY), RECONNECT_MAXIMUM) self.reconnecting = true var reconnectTimer = setTimeout(function () {