FG
💻 Software📡 Networking

JS exceptions thrown while just idling (WebSocket is already in CLOSING or CLOSED state.)

Freshover 4 years ago
Mar 14, 20260 views
Confidence Score81%
81%

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

Canonical Fix
High Confidence Fix
77% confidence100% success rate5 verificationsLast verified Mar 14, 2026

Solution: JS exceptions thrown while just idling (WebSocket is already in CLOSING or CLOSED state.)

Low Risk

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

77

Trust Score

5 verifications

100% success
  1. 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

Worked: 5
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

socket.iowebsocketrealtime