How do I subscribe to all topics of a MQTT broker

Yugandhar Chaudhari picture Yugandhar Chaudhari · Oct 2, 2015 · Viewed 105.8k times · Source

I want to connect a client which will monitor all the topics of the broker to respond to the events when I don't know what are names of topic.

Answer

ralight picture ralight · Oct 2, 2015

Subscribing to # gives you a subscription to everything except for topics that start with a $ (these are normally control topics anyway).

It is better to know what you are subscribing to first though, of course, and note that some broker configurations may disallow subscribing to # explicitly.