If you need to get a lot of values, take a look at a flow control library like async . For example, here, as you could get several values from the client in parallel :
var async = require('async'); async.parallel([ client.get.bind(this, 'nickname'), client.get.bind(this, 'room'), client.get.bind(this, 'anotherValue') ], function(err, results) { // here, `err` is any error returned from any of the three calls to `get`, // and results is an array: // results[0] is the value of 'nickname', // results[1] is the value of 'room', // results[2] is the value of 'anotherValue' });
source share