Socket#request:Request A getter proxy that returns the reference to the request that originated the underlying engine.io Client. Useful for accessing request headers such as Cookie or User-Agent.
I store the socket by ID separately. When logging in, emit('login',id), the server responds by updating the socket's id, and deletes it when exiting, socket.id=null, socketManager.remove('xx') .
socket.io
通过 socket.request.headers.cookie 来得到cookie
通过 socket.request.session 来得到session
I store the socket by ID separately. When logging in, emit('login',id), the server responds by updating the socket's id, and deletes it when exiting, socket.id=null, socketManager.remove('xx') .