I’m looking for best practices for a Socket.IO based Login with Cookies. So far, the Login exists but now I’d like to write a cookie without sending a new page and when the user comes back he will still be logged in. Am I right when I say that it’s impossible with Socket.IO since at least the Flash-Fallback won’t save the coookie correctly on client-side?
Share
Sails solves this problem by mocking Express requests for each incoming Socket.io call. One case you’ll want to consider is if a ws:// request hits before an http:// request ever goes through. In that case, you won’t have a cookie yet. Rather than completely abandoning cookies as a persistence system, what I usually do, in the absence of a cookie, is trigger an http request to try and acquire one. Hope that helps!