Skip to content

Commit

Permalink
allow -1 for maxReconnectionAttempts meaning "no limit"
Browse files Browse the repository at this point in the history
  • Loading branch information
frzme committed May 27, 2011
1 parent 6736485 commit 419e559
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion support/socket.io-client/lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* - `maxReconnectionDelay` Maximum reconnection delay in milliseconds. The reconnectionDelay will never become greater
* than this value. Default is -1 which means no limit.
* - `maxReconnectionAttempts` Number of attempts we should make before seizing the reconnect operation, defaulting to 10.
* A value of -1 means no limit.
* - `rememberTransport` Should the successfully connected transport be remembered in a cookie, defaulting to true.
*
* Examples:
Expand Down Expand Up @@ -428,7 +429,7 @@
if (!self.connected){
if (self.connecting && self.reconnecting) return self.reconnectionTimer = setTimeout(maybeReconnect, 1000);

if (self.reconnectionAttempts++ >= self.options.maxReconnectionAttempts){
if (self.reconnectionAttempts++ >= self.options.maxReconnectionAttempts && self.options.maxReconnectionAttempts != -1){
if (!self.redoTransports){
self.on('connect_failed', maybeReconnect);
self.options.tryTransportsOnConnectTimeout = true;
Expand Down

0 comments on commit 419e559

Please sign in to comment.