Skip to content

pages apart from index.html dont connect to socket .io #4544

Discussion options

You must be logged in to vote

It seems there is a typo in the agent.html file:

socket.auth = { username }

Instead of:

socket.auth = { user_name }

in the index.html

So the middleware here prevents the connection and closes the WebSocket connection:

const username = socket.handshake.auth.user_name;
if (!username) {
  return next(new Error("invalid username"));
}

Could you please check?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@flippedoffbit
Comment options

Answer selected by flippedoffbit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants