Comparing version 0.6.1 to 0.6.2
@@ -11,2 +11,3 @@ var type = require('../message/type') | ||
var AIN = type.AIN | ||
var SID = type.SID | ||
@@ -83,2 +84,4 @@ var QueueChannel = module.exports = function QueueChannel(socket, ns, name) { | ||
meta[MCH] = pack.chn || queue.chn | ||
if (pack.sid) | ||
meta[SID] = pack.sid | ||
if (!meta[MCH]) | ||
@@ -85,0 +88,0 @@ throw new Error('Channel name is required for sending channel message.') |
@@ -52,2 +52,7 @@ var type = require('../message/type') | ||
// In case we have SID in meta we only want to send to the stream which has | ||
// SID as one of its tag. | ||
if (meta[SID]) | ||
_streams = this.getStreamsBySid(meta[SID], _streams) | ||
var len = _streams.length | ||
@@ -145,4 +150,3 @@ if (0 === len) | ||
// Let's find our untrusted stream first. | ||
var sidTag = prefixTags(SID, meta[SID]) | ||
var sidStreams = this.socket.getStreamsByTag(sidTag) | ||
var sidStreams = this.getStreamsBySid(meta[SID]) | ||
if (1 === sidStreams.length) { | ||
@@ -214,2 +218,8 @@ var sidStream = sidStreams[0] | ||
QueueGateway.prototype.getStreamsBySid = function(sid, streams) { | ||
var sidTag = prefixTags(SID, sid) | ||
var sidStreams = this.socket.getStreamsByTag(sidTag, streams) | ||
return 1 === sidStreams.length ? sidStreams : [] | ||
} | ||
QueueGateway.prototype.beforeDispatch = function(pack, stream, dispatch) { | ||
@@ -216,0 +226,0 @@ dispatch(pack, stream) |
@@ -36,2 +36,11 @@ var que = require('./que') | ||
SocketChannel.prototype.pubSid = function(sid, event, msg) { | ||
var args = que.getArgs(arguments, msg, 2, 1, 3) | ||
this.queue.pub(this.streams, { | ||
sid: sid, | ||
event: event, | ||
msg: args.msg | ||
}) | ||
} | ||
SocketChannel.prototype.allow = function(allowFn) { | ||
@@ -38,0 +47,0 @@ this.queue.allow = allowFn |
{ | ||
"name": "socketmq", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Lightweight stream-oriented messaging library for node.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72412
2103