File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 104104 debug : false ,
105105 /** The number of milliseconds to delay before attempting to reconnect. */
106106 reconnectInterval : 1000 ,
107+ /** The maximum number of milliseconds to delay a reconnection attempt. */
108+ maxReconnectInterval : - 1 ,
107109 /** The rate of increase of the reconnect delay. Allows reconnect attempts to back off when problems persist. */
108110 reconnectDecay : 1.5 ,
109111 /** The maximum time in milliseconds to wait for a connection to succeed before closing and retrying. */
232234 }
233235 eventTarget . dispatchEvent ( generateEvent ( 'close' ) ) ;
234236 }
237+ var timeout = self . reconnectInterval * Math . pow ( self . reconnectDecay , self . reconnectAttempts ) ;
238+ if ( self . maxReconnectInterval != - 1 && timeout > self . maxReconnectInterval )
239+ timeout = self . maxReconnectInterval ;
240+
235241 setTimeout ( function ( ) {
236242 self . reconnectAttempts ++ ;
237243 connect ( true ) ;
238- } , self . reconnectInterval * Math . pow ( self . reconnectDecay , self . reconnectAttempts ) ) ;
244+ } , timeout ) ;
239245 }
240246 } ;
241247 ws . onmessage = function ( event ) {
You can’t perform that action at this time.
0 commit comments