Skip to content

Making a Socket io singleton class to be used in any file #4173

Answered by darrachequesne
hmzakhalid asked this question in Q&A
Discussion options

You must be logged in to vote

The connect event is not emitted, because the connection is denied with next(new Error('unauthorized')). The socket.request.session is defined, but passport is not able to fetch the user from it. I think you are missing an authentication strategy, like http://www.passportjs.org/docs/username-password/.

You will find a complete example with Passport here: https://github.com/socketio/socket.io/tree/master/examples/passport-example

Replies: 1 comment 1 reply

Comment options

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

Answer selected by hmzakhalid
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