Skip to content

Instantly share code, notes, and snippets.

@dshaw
Created October 6, 2010 19:41
Show Gist options
  • Select an option

  • Save dshaw/613945 to your computer and use it in GitHub Desktop.

Select an option

Save dshaw/613945 to your computer and use it in GitHub Desktop.
dreadnode game.gamecast()
// Optimize gamecast with ( http://github.com/LearnBoost/Socket.IO-node/blob/master/lib/socket.io/listener.js#L83-90 ):
Listener.prototype.broadcast = function(message, except){
for (var i = 0, k = Object.keys(this.clients), l = k.length; i < l; i++){
if (this.clients[k[i]] && (!except || [].concat(except).indexOf(this.clients[k[i]].sessionId) == -1)){
this.clients[k[i]].send(message);
}
}
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment