Force websocket close without reconnection how?
See original GitHub issueHi pal,
How do you intentional close the websocket without reconnection execution, its necessary to pass event code to close method?
when manually invoke close method I think that the reconnection should not be done
ws.close()
thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (9 by maintainers)
Top Results From Across the Web
WebSocket.close() - Web APIs - MDN Web Docs
The WebSocket.close() method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED , this method ...
Read more >How to reconnect to websocket after close connection [duplicate]
Just make a new WebSocket again. The reason a reconnect doesn't exist is because it would probably be just like creating a new...
Read more >How to Disconnect a WebSocket Connection in JavaScript?
To close a WebSocket connection, you can simply use the WebSocket.close() method, for example, like so:
Read more >How to Close a WebSocket (Correctly) - Forty Years of Code
A client WebSocket that starts the closing handshake fails to transition to the Closed state when the server acknowledges the initial Close ......
Read more >WebSockets - Closing a Connection - Tutorialspoint
Closing a connection is possible with the help of onclose event. After marking the end of communication with the help of onclose event,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nonotest Thanks~! You could wrap/overwrite the
reconnect
method after you initialize Sockette.Since the
onclose
event is passed toreconnect()
directly, you can assert against/abort the reconnection.It sounds like RN is doing something funky – and tbh, I’ve never used or plan to use RN so I can’t really help in that particular context.
Hello,
When using a browser and connecting to the same server, I get the correct close code (using sockette as well), so I would definitely say there is something happening on the RN side.
I have found a few people talking about it https://github.com/facebook/react-native/issues/12678 but the issue was closed without much discussion… I am not on the latest RN version (55.3) so not 100% sure if it’s the intended behaviour thus I would not automatically exclude it for browsers.
I will try with RN latest and do some more research later and update you!
thank you.