Closed rahulbhanushali closed 8 years ago
You should probably attach an example here. Il giorno lun 9 mag 2016 alle 18:12 Rahul Bhanushali < notifications@github.com> ha scritto:
I am trying to restrict subscriptions to specific topics on aedes using the authorizeSubscribe method.
I tried the example code shown in the documentation, however was not able to restrict users from subscribing.
Can you please help me in implementing this?
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/mcollina/aedes/issues/48
I tried multiple variations as demonstrated in readme file.
I tried this code snippet but was still able to receive messages when someone published message to the topic 'bbb'
instance.authorizeSubscribe = function (client, sub, done) {
if (sub.topic === 'bbb') {
// overwrites subscription
sub.qos = sub.qos + 128
}
callback(null, sub)
}
The following code snippet causes the client to reconnect again and again
instance.authorizeSubscribe = function (client, sub, done) {
if (sub.topic === 'aaaa') {
return cb(new Error('wrong topic'))
}
}
None of the above methods seem to work.
The latter is expected, as the subscription is causing an error.
There previous example is wrong (even in the README), you need to set sub
to false to negate.
Setting sub to null works, thanks :)
I am trying to restrict subscriptions to specific topics on aedes using the authorizeSubscribe method.
I tried the example code shown in the documentation, however was not able to restrict users from subscribing.
Can you please help me in implementing this?