Express Sessions with connect-redis + Socket.IO in CoffeeScript

If you are working with Socket.IO and Express Framework while developing your applications you must know they work together so Socket.IO will listen on the same port that your HTTP/S server and will serve the requests by that way, but Socket.IO doesn't works on the same paradigm where you pass a middleware to the route and you could get authentication on this manner. Instead, you must configure Socket.IO with a global authorization method or a handshake authorization manner.

Since in my applications I serve cookies already where I save session info and this is already stored in Redis with help of the module connect-redis then I should be able to get this info onto Socket.IO authorization method and with this allow only to authorized users to get info from my websockets.

I found how to do it with the default session-store in-memory from Express, and adapted that so it could work with Redis.

Here's the snippet:

Hope anyone can found it useful!

Any comment goes best to my twitter here.