With this setup, we can connect/disconnect from the socket using buttons in the UI. But if you force a refresh (e.g. hitting 'R' in the react-native console, "Reload App" in the debugger, or modifying some source files with Fast Refresh) while the socket is open, it remains open with no way to access it anymore. Verified using Wireshark that the connection isn't closed. Reload in this manner doesn't seem to trigger any onBeforeUnload hooks either, so I don't think it could be cleaned up that way.
Expected behavior
Any existing open sockets automatically close on page unload/refresh.
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community attention? This issue may be closed if no further activity occurs.
Description
Client sockets seem to remain open when refreshing the page, with no apparent way to close it.
This is an issue for us since the server we're connecting to only accepts a single client at a time (it's a network printer).
Steps to reproduce
Our code looks something like this:
Current behavior
With this setup, we can connect/disconnect from the socket using buttons in the UI. But if you force a refresh (e.g. hitting 'R' in the react-native console, "Reload App" in the debugger, or modifying some source files with Fast Refresh) while the socket is open, it remains open with no way to access it anymore. Verified using Wireshark that the connection isn't closed. Reload in this manner doesn't seem to trigger any onBeforeUnload hooks either, so I don't think it could be cleaned up that way.
Expected behavior
Any existing open sockets automatically close on page unload/refresh.
Relevant information