How to create a handshake between PHP web server and Socket.io on node.js server? How to create a handshake between PHP web server and Socket.io on node.js server? express express

How to create a handshake between PHP web server and Socket.io on node.js server?


Store the token in the browser and send it along with every request from the php, with an authorization bearer which looks like :

Authorization: Bearer token

So everytime the node.js server get's an request you can compare the token to which user corresponds and get the data.

You can store the relationship between the userid and the token with an expiry date in a table and refresh the token on every login.

Also if you don't want to use a table, you can store the data in the token, with JWT

You can find more info here:

http://jwt.io/