|
Re: Nodejs Cluster with MQTT client [message #1843941 is a reply to message #1843925] |
Wed, 25 August 2021 08:31 |
Roger Light Messages: 90 Registered: September 2013 |
Member |
|
|
Yes, you can use MQTT v5 shared subscriptions. The client doesn't even need to support MQTT v5.
If you want to subscribe to my/topic, then instead subscribe to $share/<sharename>/my/topic
The <sharename> effectively defines a group. Within that group, only a single client will receive a given publish message.
So for example, if you had the following subscriptions:
Client A: $share/group1/my/topic
Client B: $share/group1/my/topic
Client C: $share/group1/my/topic
Client D: $share/group2/my/topic
Client E: $share/group2/my/topic
And then published four messages to my/topic, then the clients would receive the following messages:
Client A: message1, message4
Client B: message2
Client C: message3
Client D: message1, message3
Client E: message2, message4
I hope that helps.
Regards,
Roger
|
|
|
Powered by
FUDForum. Page generated in 0.03648 seconds