Skip to content

Commit

Permalink
Merge pull request #26 from nkzawa/patch-0
Browse files Browse the repository at this point in the history
Fix to apply volatile and compress flags when bloadcasting
  • Loading branch information
rauchg committed Apr 5, 2015
2 parents 4a1a66a + bd48c2f commit de5cba4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Expand Up @@ -112,6 +112,11 @@ Adapter.prototype.broadcast = function(packet, opts){
var rooms = opts.rooms || [];
var except = opts.except || [];
var flags = opts.flags || {};
var packetOpts = {
preEncoded: true,
volatile: flags.volatile,
compress: flags.compress
};
var ids = {};
var self = this;
var socket;
Expand All @@ -127,7 +132,7 @@ Adapter.prototype.broadcast = function(packet, opts){
if (ids[id] || ~except.indexOf(id)) continue;
socket = self.nsp.connected[id];
if (socket) {
socket.packet(encodedPackets, true, flags.volatile);
socket.packet(encodedPackets, packetOpts);
ids[id] = true;
}
}
Expand All @@ -138,7 +143,7 @@ Adapter.prototype.broadcast = function(packet, opts){
if (self.sids.hasOwnProperty(id)) {
if (~except.indexOf(id)) continue;
socket = self.nsp.connected[id];
if (socket) socket.packet(encodedPackets, true, flags.volatile);
if (socket) socket.packet(encodedPackets, packetOpts);
}
}
}
Expand Down

0 comments on commit de5cba4

Please sign in to comment.