react-websocket
react-websocket copied to clipboard
state.attempts is never reset
In the situation where periodic disconnections are expected, the component will eventually always use the max retry backoff, because a successful reconnection never resets state.attempts.
I'll happily put together a pull request if you'd like, or just add this snippet
websocket.onopen = () => {
this.logging('Websocket connected')
this.setState({ attempts: 1 }) // Add this line so that reconnecting resets the retry cooloff.
...