Code Monkey home page Code Monkey logo

Comments (10)

mcollina avatar mcollina commented on August 20, 2024

What you want is https://github.com/mqtt/mqtt.github.io/wiki/bridge_protocol.

Unfortunately, this is not currently supported in Mosca.

from aedes.

cristian-stoicescu avatar cristian-stoicescu commented on August 20, 2024

I'm not so sure this would be a good fix.
I'm referring to the possibility of ignoring certain subscribed clients which meet a specific criteria, when publishing a certain message from the broker ( all clients are connected to the same broker )
So basically, adding some sort of filter ( probably based on id, regex maybe ? ) when publishing a message from the broker to subscribed clients
p.s.: I know this a bit far fetched. I`m just hypothetically asking if this could be done in Aedes

from aedes.

mcollina avatar mcollina commented on August 20, 2024

In mosca there is authorizeForward. I will probably add the same thing here.

from aedes.

stochris avatar stochris commented on August 20, 2024

Ok. So, instead of directly forwarding, it should call the authorizeForward, which in turn may call the forward callback, right ?

from aedes.

mcollina avatar mcollina commented on August 20, 2024

That's in Mosca, yes.

from aedes.

cristian-stoicescu avatar cristian-stoicescu commented on August 20, 2024

Yes, in mosca terms. In aedes terms, I`m thinking a callback should be added to the publishActions array ( https://github.com/mcollina/aedes/blob/master/lib/handlers/publish.js#L15 )
I'll have a look when I have some time, and submit a pr if I get anywhere. Is that ok ? :)

from aedes.

cristian-stoicescu avatar cristian-stoicescu commented on August 20, 2024

I looked around, and from what I can gather, Aedes.prototype.subscribe should recieve the client, in order to be able to do any fine grained filtering based on it and send it further down towards the notify function added in MQEmitter.prototype.on function.
Then, more or less wrap every call to the matched topic methods to a authorizeForward function

However, I'd like to hear your input before I change anything, since this looks pretty since this way looks pretty hacky.
le:
Also, I`m thinking this could really affect perfomance, and given the low overhead of an mqtt packet, the clients could just handle their own filtering, instead of passing the responsibility on the broker.

from aedes.

mcollina avatar mcollina commented on August 20, 2024

I agree with your evaluation on performance, and that's why I did not do it in the first place here.

However, if you can come up with a way that implements this without affecting performance and it's valid, I'll be more than happy to merge it.

I suggest you to put it in https://github.com/mcollina/aedes/blob/master/lib/client.js#L71-L86, and https://github.com/mcollina/aedes/blob/master/aedes.js#L204 (for QoS 1/2 and offline).

Doing it in MQEmitter will be wrong, as authorization is not one of its responsibilities.

from aedes.

cristian-stoicescu avatar cristian-stoicescu commented on August 20, 2024

Ok, I'll look into it and add some tests once I get it working

from aedes.

mcollina avatar mcollina commented on August 20, 2024

Released in 0.16.0.

from aedes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.