Skip to content

Instantly share code, notes, and snippets.

@parshap
Created February 13, 2012 05:02
Show Gist options
  • Save parshap/1813827 to your computer and use it in GitHub Desktop.
Save parshap/1813827 to your computer and use it in GitHub Desktop.
irc - async example w/ async.js
function getRooms(callback) {
client.smembers('rooms', callback)
}
function getResults(rooms, callback) {
async.parallel(rooms, function(room, callback) {
client.hgetall('room_' + room, callback);
}, callback);
}
socket.on('list rooms', function(data){
async.waterfall([
getRooms,
getResults
], function(err, results) {
socket.emit('list rooms', JSON.stringify(results));
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment