JS exceptions thrown while just idling (WebSocket is already in CLOSING or CLOSED state.)
Problem
You want to: [x] report a bug [ ] request a feature Current behaviour While leaving a socket connected, but doing no other activity in my program, I see intermittently (but fairly consistently) an exception thrown in browser console, from inside of the socket.io machinery (specifically in `backo2/index.js` line 83. That error is: [code block] Steps to reproduce (if the current behaviour is a bug) I have two tabs open with client sockets connected to the same server (localhost) via https. Both clients are sitting idle with nothing else happening in browser or server (except for whatever keep-alive pings socket.io is doing). Both of them are joined to a single channel (via `join(..)` on the server). Otherwise, nothing else special. Here's how I create the server socket instance: [code block] And in the client: [code block] Expected behaviour I expect disconnections and reconnections from time to time, but I don't expect spurious JS exceptions thrown by the library when I'm not doing anything else over the connections. Setup - OS: Mac OSX - browser: Chrome 66, node 10.2.1 - socket.io version: 2.1.1 Other information (e.g. stacktraces, related issues, suggestions how to fix) Expanded stack trace: [code block]
Error Output
exception thrown in browser console, from inside of the socket.io machinery (specifically in `backo2/index.js` line 83. That error is:
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: JS exceptions thrown while just idling (WebSocket is already in CLOSING or CLOSED state.)
Experiencing absolutely the same issue and the code is correct. This only happens in Chrome for me. Mozilla is clean. In chrome, this err is raining over and over and duplicating all the chats I have. I tried using this method ` socket.on('disconnect', () =>{ socket.disconnect(); });` It doesn't disconnect the client from the server. Repo in case needed https://github.com/anton
Trust Score
5 verifications
- 1
Experiencing absolutely the same issue and the code is correct. This only happen
` socket.on('disconnect', () =>{ socket.disconnect(); });` It doesn't disconnect the client from the server. Repo in case needed https://github.com/antoniab123456/Chat_app
Validation
Resolved in socketio/socket.io GitHub issue #3259. Community reactions: 8 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep