How to make shared subscribe?


I want to use shared subscribe and I have tried these:

# subscriber client 1
mosquitto_sub -d -t $share/mytopic
mosquitto_sub -V 5 -d -t $share/mytopic

# subscriber client 2
mosquitto_sub -d -t $share/mytopic
mosquitto_sub -V 5 -d -t $share/mytopic

# publisher client
mosquitto_pub -t /mytopic -m "hello"
mosquitto_pub -V 5 -t /mytopic -m "hello"

However, it doesn’t work.

Hi ackema,

I see three possible reasons for your problem:

  1. in your example you are not using a group Id as part of the topic tree.
  2. In the publish you are using “/mytopic” instead of mytopic
  3. Linux sometimes swallows $ sings if you are not putting it into single quotes

does any of the above fix your problem? :slight_smile:

Thanks a lot!

Problem solved

1 Like