Skip to content

Commit

Permalink
Merge pull request #66 from Kosta-Github/Kosta/performance_opt
Browse files Browse the repository at this point in the history
Kosta/performance opt
  • Loading branch information
nkzawa committed Nov 20, 2015
2 parents 7d78149 + abc23f2 commit f6770c7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,14 @@ function adapter(uri, opts){
Redis.prototype.broadcast = function(packet, opts, remote){
Adapter.prototype.broadcast.call(this, packet, opts);
if (!remote) {
var chn = prefix + '#' + packet.nsp + '#';
var msg = msgpack.encode([uid, packet, opts]);
if (opts.rooms) {
opts.rooms.forEach(function(room) {
var chn = prefix + '#' + packet.nsp + '#' + room + '#';
var msg = msgpack.encode([uid, packet, opts]);
pub.publish(chn, msg);
var chnRoom = chn + room + '#';
pub.publish(chnRoom, msg);
});
} else {
var chn = prefix + '#' + packet.nsp + '#';
var msg = msgpack.encode([uid, packet, opts]);
pub.publish(chn, msg);
}
}
Expand Down

0 comments on commit f6770c7

Please sign in to comment.