I am creating a chat application for which for each client connection I need to set some attributes for each client instance using socket.io. When I save the attribute, I use:
client.set('name', name, function () {}); client.set('email', email, function () {}); ....
and it works fine. When I need to get all the properties of the client, I did not find a better way than this:
client.get("name",function(err,name) { client.get("email",function(err,email) { ....... } }
I need to enclose all "get" for asynchronous data retrieval; but if I had 10 properties, do I need to invest all 10 items? There must be a better way to do this, can someone help me?
source share