Can't get wsLink's retryDelayMs to work
I'm trying to add some backoff for when connecting to my websocket server fails. I've got the following code, but the
retryDelayMs function never seems to be called (I don't see any console messages), and the wsLink keeps trying to reconnect immediately:
1 Reply
The issue arises from the way
wsLink resets the connectAttempt counter upon a successful connection. This make total sense. However, in my case, my WebSocket server validates a session cookie in the connect event handler, and closes the connection on an invalid session. The connectAttempt counter is still reset, because this is a successful connection followed immediately by a close().
Maybe it would make sense to only reset the connectAttempt counter after a successful request/response from the WebSocket server.