Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An explanation of session support using Express and Socket.IO?

I'm looking for some help figuring out sessions on a server that relies on express and socket.io. Mostly the goal is handling things like pairing socket.io session ids with user ids, maintaing state on reconnects, and being able to easily group any actors on the server.

Any help is very much appreciated.

Thanks.

like image 801
fancy Avatar asked Jun 03 '11 01:06

fancy


1 Answers

I've just uploaded a project which allows you to use your sessions from express in Socket.IO. Maybe this can be of some help to you. https://github.com/aviddiviner/Socket.IO-sessions

You can install it with npm install socket.io-sessions. Be sure to check out the README.

If you're new to Node, I would suggest spending some time reading through the express docs on how they handle sessions as well. http://expressjs.com/guide.html#session-support

Lastly, I've also posted some code snippets here: socket.io and session?

Hope that helps!

like image 112
Dave Avatar answered Sep 28 '22 13:09

Dave