Archive for October 2011
UPDATE 11/28/2011: After talking with TJ Hallowaychuck I discovered I was doing it wrong… there are better ways to do this then the hack I had come up with. Using connect to parse the cooie you can use this instead:
Which is much cleaner than what I originally posted. The original post is intact for historical reasons.
I thought I’d post on a technique I’ve been using to associate the users session with a socket.io server. Although this technique was done in a pure node.js app, it’s probably possible to do the same to grab the session id from your PHP app or Grails app that is utilizing socket.io.
Anyhow, here’s what I’m rolling with:
Yep, it’s sneaky. I sniff the sid out and simply use redisClient (since redis is my backing session store) to look the session up. Now on all socket requests I can access the session directly.