I know that I can use
function(req, res) {
req.session
}
using express. However I need to access the session outside of the response func
I believe checking socket.handshake
should get you the session:
io.sockets.on('connection', function(socket) {
console.log(socket.handshake.sessionID);
});
When the client establishes a socket connection with your socket.io server, the client sends a WebSocket handshake request. What I'm doing above is grabbing the session ID from the handshake.