[core][mqtt-in] Shared Subscriptions for core node MQTT-In (MQTT v5)

Hi,

this is the first self created topic in this forum, be kind please :stuck_out_tongue: :
Short:

  • Assuming a MQTT Broker capable of shared subscriptions
  • MQTT.js "supports" shared supscriptions (at least not prevents them)
  • The core node "MQTT-In" has a method matchTopic that prevents shared subscriptions from working.
  • I already fixed it locally, happy to contribute via PR

Extended:
Shared Subscriptions for MQTT as already implemented by some brokers and defined in MQTT v5:

  • subscribe to: $share/SHARENEMAE/topic
  • publish to: topic
  • the broker will forward the message to only ONE subsriber (client id) of the topic.

To my understanding the matchTopic(ts,t) function in nodes/core/io/10-mqtt.js checks if the topic string subscribed to matches the topic string in the received message (including MQTT wildcards etc.).
With shared subscriptions ts will not match t ($share/SHARENEMAE/topic vs. topic).

I am not saying this will implement v5 just "not prevent" shared subscriptions.

I will create a PR today.

Any comments?

Best regards
Lars

Just comment: reading your link - calling them shared subscriptions seems one of the most un-intuitive naming conventions I've ever come across after urban slang bad = good !

[edit] Just found https://www.hivemq.com/blog/mqtt-client-load-balancing-with-shared-subscriptions/ and I'm a bit more on-board now :slight_smile: [/edit]

Glad to hear that - I am not a native speaker.. did not notice anything wrong with the name but
as you see I did not choose the name :slight_smile:

We use VerneMQ right now, they call it shared subscription, hiveMQ does and also the MQTT v5 Specification.
https://vernemq.com/docs/configuration/shared_subscriptions.html
http://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html

No matter the name, it is great for autoscaling clients for example.

1 Like