We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e70fc3b commit c3c5cc8Copy full SHA for c3c5cc8
reconnecting-websocket.js
@@ -122,6 +122,9 @@
122
123
/** The maximum time in milliseconds to wait for a connection to succeed before closing and retrying. */
124
timeoutInterval: 2000
125
+
126
+ /** The maximum number of reconnection attempts to make. Unlimited if null. */
127
+ maxReconnectAttempts: null,
128
}
129
if (!options) { options = {}; }
130
@@ -202,6 +205,10 @@
202
205
eventTarget.dispatchEvent(generateEvent('connecting'));
203
206
204
207
208
+ if (this.maxReconnectAttempts && this.reconnectAttempts > this.maxReconnectAttempts) {
209
+ return;
210
+ }
211
212
if (self.debug || ReconnectingWebSocket.debugAll) {
213
console.debug('ReconnectingWebSocket', 'attempt-connect', self.url);
214
0 commit comments