Adding a cookie value on Socket.IO
Take a look at Authorization with Socket.io. This is where it handles the initial connection request, and where you can set a response header.
I'm not sure if the cookie(name,value)
shorthand works, though you can try setting it manually:
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000)); // set day value to expiry
var expires = "; expires="+date.toGMTString();
handshake.headers.cookie = name+"="+value+expires+"; path=/";