Skip to content

Instantly share code, notes, and snippets.

@rf
Forked from parshap/gist:1813827
Created February 13, 2012 05:12
Show Gist options
  • Save rf/1813857 to your computer and use it in GitHub Desktop.
Save rf/1813857 to your computer and use it in GitHub Desktop.
irc - async example
// Get a list of rooms...
socket.on('list rooms', function(data){
client.smembers('rooms', function(err, rooms){
var remaining = rooms.length,
array = []
async.forEach(rooms, function (room, done) {
client.hgetall('room_' + room, function (e, result) {
array.push(result);
done();
});
}, function () {
socket.emit('list rooms', JSON.stringify(array));
);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment