joewalnes / reconnecting-websocket

A small decorator for the JavaScript WebSocket API that automatically reconnects
MIT License
4.24k stars 970 forks source link

Don't create the WebSocket if we've reached maxReconnectAttempts. #82

Closed nguarracino closed 1 year ago

nguarracino commented 7 years ago

The new WebSocket() line in this.open() is actually called this.maxReconnectAttempts + 1 times. The last time just returns immediately after. This change detects if this.maxReconnectAttempts has been hit before creating the WebSocket.