If a message is sent to the topic in an mqtt broker, I want to know the topic by Python. In order to use client.subscribe (), I have to manually enter a topic, so I need to know the topic before client.subscribe() dynamically. Is there a way to know what broker topics are?
If you send "EVERY" message to broker with retain message = True, then you can:
This solution subscribe twice, may not fit your original requirement (only subscribe once), but can do what you want