express-socket.io-session
express-socket.io-session copied to clipboard
Socket IO session does not update when express session changes
I'm having the same problem as this person (just not about passportJS... I'm trying to set own session).
I'm not sure what I missed. Thanks!
http://stackoverflow.com/questions/35165060/socket-io-session-does-not-update-when-req-session-changes
http://stackoverflow.com/questions/35165060/socket-io-session-does-not-update-when-req-session-changes/39060923#39060923
Is there a reason this isn't already object oriented? I expect a long running socket would have many updates to the session and possibly from a number of sources. Calling socket.handshake.session.reload() before accessing the session object becomes troublesome.
Why?
I find objects helpful when passed into promises and other asynchronous functions. Being that these sessions could be changed in a number of ways over periods of time, reusing the same object would be helpful to that end.
I had a similar issue where I would login, which would issue a new cookie, but the session handshake still had the old session information. Even a "reload()" would not work because the cookie sessionId was no longer valid. I solved the problem on the client by forcing a reconnect for the socket after login/logout (since I am using regular HTTP for initial login).
When a logout happened, I would call socket.disconnect() then socket.connect() - this is the only thing that worked with the application structure I had.
Is there a reason this isn't already object oriented? I expect a long running socket would have many updates to the session and possibly from a number of sources. Calling
socket.handshake.session.reload()before accessing the session object becomes troublesome.
TypeError: socket.handshake.session.reload(...) is not a function
@Zaniyar Have you ever solved it?