Skip to content
This repository was archived by the owner on Jan 31, 2019. It is now read-only.
This repository was archived by the owner on Jan 31, 2019. It is now read-only.

namespace authentication messages are missed #22

@scottdupoy

Description

@scottdupoy

Hi,
I've been trying to get socketio-auth working with a site that uses namespaces. I could be missing something but I think I've found an issue and written a fix that works for me on my fork.
What do you think?
Thanks,
Scott

Problem:

  • socketio-auth only listens for incoming connection events on the io object itself, not on each namespace.
  • When an incoming socket connection to a namespace opens on the server, it seems to add a socket to the root namespace and the namespace it connected to (they have the same socket ids, however).
  • The authentication message from the client comes in on the namespace socket and not the root namespace one. The message is missed because socketio-auth is listening on the root socket.
  • The timeout then fires and disconnects the root socket which disconnects the client socket.

Proof of concept fix on my fork:

  • Add connection listeners to all namespaces, each with their own timeout.
  • If a socket is authenticated, search each namespace for sockets with the same id and for each of these sockets:
    • restore the connected socket.
    • emit an authenticated message.
    • call postAuthenticate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions