socket.io-client
socket.io-client copied to clipboard
Socket.io-client fires "connect" event but can't send events to server
Describe the bug
If I leave my site domain and use the browser back button to return socket.io-client fires the "connect" event, but the client socket can't send any events to the server until the connection is disconnected and then reconnects or I refresh the page.
To Reproduce
Please fill the following code example:
Socket.IO server version: 4.5.4
Socket.IO client version: 4.5.4
Link to repl: https://replit.com/@ambil/socket-io-bug-example#index.js
- Click "Open website" to run code fiddle in a new browser tab
- Click the "Test Event" button. You'll see a new message appended to the list with each click that says: "event: button_clicked"
- In the same browser tab, navigate to a new domain (ex: google.com)
- Use the browser back button to navigate back to the previous tab
- Without refreshing the page, click the "Test Event" button. Notice a new message is not appended to the list, although the status shows "Connected"
Expected behavior Since the client is firing off the "connect" event, I'd expect the server to acknowledge client events right away.
Platform:
- Chrome for MacOS