Socket io how to start a new session to access cookies

Viewed 29

I'm trying to find a way to access to an updated cookie with socket.io. I'm using cookie.parse(socket.handshake.headers.cookie) to access the cookie on the server. As I understand it the handshake object contains the headers of the first HTTP requests of the socket.io session.

In my app, I'm using HTTP requests for log in and log out, so that when a user logs in the cookie is set and when the user logs out the cookie is cleared. I have tried to use socket.disconnect() on the client when a user logs out, but still when a new user logs in, unless the browser is refreshed cookie.parse() returns the previous cookie. Is there a way to reset the session with socket.io?

Thanks for any help.

0 Answers
Related