Skip to content

Instantly share code, notes, and snippets.

@elben
Created March 11, 2011 05:51
Show Gist options
  • Save elben/865517 to your computer and use it in GitHub Desktop.
Save elben/865517 to your computer and use it in GitHub Desktop.
for(i in docs) {
var doc = docs[i];
if(doc != null) {
var msg = doc['project_id'] + '. ' + doc['created_at'] + '. ' + doc['message'];
sys.puts("I'll send " + msg);
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