Skip to content

Instantly share code, notes, and snippets.

@elben
Created March 11, 2011 06:08
Show Gist options
  • Save elben/865525 to your computer and use it in GitHub Desktop.
Save elben/865525 to your computer and use it in GitHub Desktop.
docs.forEach(function(doc) {
if(doc != null) {
var msg = doc['project_id'] + '. ' + doc['created_at'] + '. ' + doc['message'];
redis_client.smembers("conn:project:" + doc['project_id'], function(err, client_ids) {
client_ids.forEach(function(client_id, i) {
client = socketio.clients[client_id];
if(typeof client != 'undefined') {
client.send(msg);
}
});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment