socketio / socketio/socket.io

Not calling next on io.of('/test') middleware does not timeout or error

Open
#5,096 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug package:socket.io-client
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

In the following code server side:

io.of('/test').use(function(socket, next){
  console.log("Authenticating...")
  //next();
});

A socket.io connecting to the /test namespace will never connect (obviously), but it will never either get a timeout or error, it will just be in a pre-connection state for ever. Seems like an innocuous bug but its not, in my example next is not called explicitly, but if the code before next throws an exception for example you will get the same result on the client side.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the server-side io.of('/test').use middleware example and observe the client when next is never called or middleware code throws. Trace the namespace middleware connection path and add coverage for the expected timeout or error behavior, then verify that the client no longer remains in a pre-connection state indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.