Home > Mobile >  How to login with socket event authentication
How to login with socket event authentication

Time:02-02

I have no idea how authenticate login user with socket.io

Authenticate user and socket server

CodePudding user response:

All socket.io connections start with an http request. You can do any authentication you want at that initial connection point.

You can also access any cookies such as a session cookie that may already exist to indicate auth that has already been done.

The socket.io library itself has middleware that can be used to implement an authentication check.

And, finally, socket.handshake contains the headers and other info from the original socket.io connect request that can be used later during any socket.io message.

  • Related