Subscribe & Act on Commands
Toggle a relay when a message arrives.
Listening for Messages
Publishing sends data out; subscribing lets your device receive it. This is how the cloud sends commands back to hardware.
Subscribe to a Topic
Tell the broker which topic you want with subscribe. From then on, matching messages are pushed straight to your device.
client.subscribe("home/livingroom/light");All lessons in this course
- Why MQTT Fits IoT
- Connect to a Broker
- Publish Sensor Topics
- Subscribe & Act on Commands