get session data?
Closed this issue ยท 5 comments
justekoro commented
justekoro commented
solved! here is the code I used:
app.io.on('connect', (socket) => {
console.info('socket connected:',socket.id);
let sid = app.parseCookie(socket.handshake.headers.cookie).sessionId;
let req = {};
app.decryptSession(sid, req, () => {
console.log(req.session)
// You can basically access req.session here
});
})
})
justekoro commented
@korobaka thanks for sharing the solution!
no problem! it would be cool to include directly socket.session in this module :)
alemagio commented
feel free to open a PR, I'll be more than happy to review ๐
justekoro commented
feel free to open a PR, I'll be more than happy to review ๐
I'll try to do this today :)