Reputation: 1069
If subscriber has topic as $share/group/my_topic
, it doesn't receive any messages, but if I change the topic to /my_topic
- everything works just fine.
It seems that M2Mqtt doesn't support shared subscriptions. Is there a workaround for this? I also need persistence to work with shared subscriptions.
If there's no workaround, offers to other libraries are welcome!
Upvotes: 0
Views: 329
Reputation: 1069
Use MQTTnet library
It can be found at https://github.com/chkr1011/MQTTnet
or as NuGET package.
It does the job, as far as I've tested!
Upvotes: 0
Reputation: 59638
I can't test this but I have a theory.
The problem is that you have a leading /
on your base topic /my_topic
If you remove this and publish messages on my_topic
then the shared topic should match.
Having a leading /
adds a null element to the topic, which you can't include in the $share/group/[null]/my_topic
While leading a /
is allowed in the MQTT spec it is considered bad practice (and can lead to issues like this).
Also the client library has no knowledge of shared subscriptions, this is entirely a broker side feature. All clients should "just work"
Upvotes: 1