socket.io-session-middleware
Share connect/express sessions with socket.io 1.x
Setup
Example
Server
var socketSession = ; var session = store: secret: "secret" key: "mykey.sid" cookieParser: connect; io; io;
Client
socket; socket; //=> I am hans
A full featured example can be found in the example folder.
Notes
Make sure to fire a http request to initialize the session/cookie before accessing the session with socket.io. If you are serving the socket.io client with your node.js server this won't be a problem for you.