I have the following code when a user is disconnected. I want to emit a signal with the name of the room and username
client.get ('nickname', function (mistake, name) {client.get ('cell', function ( Err2, room) {io.sockets.in (room) .emit ('disconnect', name);});}); My question is, is there any way that To avoid gaining? Calls like this? For my application, they are going to add quickly, can I get more than one value from a get () ? Or am I doing all this wrong? If you need to get multiple values, then look at a flow control library such as for example , Here's how to get from to multiple values in the client: var async = require ('async'); Async.parallel ([client.get.bind (this, 'nickname'), client.get.bind (this, 'cell'), client.get.bind (this, 'another value')], function (fault, The result) {// Here, 'err' gets any errors from any of the three calls, 'get', // and the result has been removed from an array: // result [0] is the value of 'nickname', / / Result [1] is the value of 'chamber', // result is the value of [2] 'second value'};
Comments
Post a Comment