0

A test MQTT broker can be found at: http://test.mosquitto.org/. The website suggests trying the command:

 mosquitto_sub -h test.mosquitto.org -t "#" -v

I believe that the "#" denote a wildcard for topics, which would show any topic and its payload.

A raspberry pi has successfully run the mosquitto command per instructables MQTT example, however no output is observed with the above command.

It is unclear if there is an entity publishing to the test server that would return a result in the subscribing client. This could be on reason that I am not observing anything. I would think there are other possible obstacles / pitfalls and look forward to enlightening responses.

Attempts to publish to a topic failed as described in: MQTT Error: Connection Lost

gatorback
  • 1,216
  • 20
  • 44
  • Did you publish anything to any topic? Of course there's no output while no client publishes anything. – Murphy Aug 06 '19 at 22:46
  • @Murphy [Yes, An attempt to publish is documented in this hyperlinked stackexchange posting](https://unix.stackexchange.com/q/534236/182280) – gatorback Aug 07 '19 at 03:59

1 Answers1

1

To answer your original question: Yes, something needs to be published in order to show a reaction for the subscribed topic. And yes, # is a wildcard, like * is for shell. And mosquitto_sub would just listen until you terminate it.

Regarding the connection issue, from the webpage:

This means that it will often be running unreleased or experimental code and may not be as stable as you might hope.

I experience the same problem, but was able to use iot.eclipse.org successfully. There's much traffic there, so better use a specific topic instead of #, but it proves that the subscription is working as expected. For your tests, just pick one from the public brokers list that doesn't require signup.

Murphy
  • 2,609
  • 1
  • 13
  • 21
  • Thanks for the helpful response: I have been able to reproduce your results at `iot.eclipse.org` Replacing the MQTT broker with iot.eclipse.org. demonstrates that the listener command syntax is correct: iot.eclipse.org has significant traffic in August 2019. Until a payload is received on the test.mosquitto.org, I do not think we can conclude anything: it could be a stability problem as indicated by Murphy or it could be nobody is publishing payloads to the test.mosquitto .org – gatorback Aug 07 '19 at 13:57