Closed dennisrijsdijk closed 1 year ago
Note: this should only be applied once the websocket doesn't reply to incoming messages.
@therungg Do you know if the multiple calls to the socket hook is spawning multiple connections? I haven't actually tested this myself but it would seem that this is what happens just based on the code.
The react-use-websocket lib has a shared
option when instantiating that creates a proxied socket object for each attempted instantiation aiming to use the same URL (and new connections for new URLs). And then my understanding is that you're expected to use getWebsocket
to retrieve the instance
https://github.com/robtaussig/react-use-websocket#getwebsocket