Adding data to socket.io object

I have a similar problem with the previous question ( Adding data to a socket.io socket object ). I am using socket.io 1.3.4 and would like to add additional data to the socket when I connect it. Socket.io usually had a method called set that allowed this, but it seems to take longer. Is there a new way to do this now?

+3


source to share


1 answer


These get / set methods seem to have been removed for 1.0:

http://socket.io/blog/introducing-socket-io-1-0/#scalability

I think the new practice is to just set properties on the socket object directly, as suggested in the question you linked.



You can see an example of this in the socket.io socket example:

https://github.com/Automattic/socket.io/blob/318d62/examples/chat/index.js#L36

+2


source







All Articles