aedes
Advanced tools
Comparing version 0.38.0 to 0.38.1
@@ -19,2 +19,3 @@ 'use strict' | ||
this.granted = granted | ||
this.subsIndex = 0 | ||
} | ||
@@ -71,8 +72,6 @@ | ||
this.granted.push(128) | ||
return done(null, sub) | ||
} | ||
if (sub && packet.subscriptions[0].topic !== sub.topic) { | ||
// don't call addSubscriptions per topic, | ||
// TODO change aedes subscribe handle, but this is a fast & dirty fix for now | ||
if (packet.subscriptions.length > 0 && ++this.subsIndex < packet.subscriptions.length) { | ||
// TODO change aedes subscribe handle, but this fix bugs for now. | ||
return done(null, sub) | ||
@@ -79,0 +78,0 @@ } |
{ | ||
"name": "aedes", | ||
"version": "0.38.0", | ||
"version": "0.38.1", | ||
"description": "Stream-based MQTT broker", | ||
@@ -5,0 +5,0 @@ "main": "aedes.js", |
@@ -569,2 +569,36 @@ 'use strict' | ||
test('negate subscription with correct persistence', function (t) { | ||
t.plan(7) | ||
var broker = aedes() | ||
broker.authorizeSubscribe = function (client, sub, cb) { | ||
t.ok(client, 'client exists') | ||
if (sub.topic === 'hello') { | ||
sub = null | ||
} | ||
cb(null, sub) | ||
} | ||
var s = connect(setup(broker), { clean: false, clientId: 'abcde' }) | ||
s.outStream.once('data', function (packet) { | ||
t.equal(packet.cmd, 'suback') | ||
t.deepEqual(packet.granted, [128, 0]) | ||
t.notEqual(broker.persistence._subscriptions.get('abcde'), undefined) | ||
t.deepEqual(broker.persistence._subscriptions.get('abcde').size, 2) | ||
t.equal(packet.messageId, 24) | ||
}) | ||
s.inStream.write({ | ||
cmd: 'subscribe', | ||
messageId: 24, | ||
subscriptions: [{ | ||
topic: 'hello', | ||
qos: 0 | ||
}, { | ||
topic: 'world', | ||
qos: 0 | ||
}] | ||
}) | ||
}) | ||
test('negate multiple subscriptions random times', function (t) { | ||
@@ -571,0 +605,0 @@ t.plan(5) |
155809
5105