Closed sleh96 closed 6 months ago
I think you have to do this:
getWebSocket().close()
The third parameter to useWebSocket
is connect
, you can set it to false to disable the connection. Or set url
to null
.
Not sure what you mean by "when the react page refeshes", it should disconnect automatically when the component unmounts.
I apologize if this is a duplicate, but I have looked for this issue in the open issues or pull requests but I could not find anything helpful. So my question is how do you disconnect a websocket client using this hook?