Recall & Review
beginner
What is the purpose of the
mosquitto_pub command?The
mosquitto_pub command is used to send (publish) messages to a topic on an MQTT broker.Click to reveal answer
beginner
What does the
mosquitto_sub command do?The
mosquitto_sub command subscribes to a topic on an MQTT broker to receive messages published to that topic.Click to reveal answer
beginner
How do you specify the topic when using
mosquitto_pub?Use the
-t option followed by the topic name. For example: mosquitto_pub -t 'home/temperature'.Click to reveal answer
beginner
How can you receive messages from a topic using
mosquitto_sub?Use the
-t option with the topic name. For example: mosquitto_sub -t 'home/temperature' will listen for messages on that topic.Click to reveal answer
beginner
What option do you use with
mosquitto_pub to specify the message content?Use the
-m option followed by the message text. For example: mosquitto_pub -t 'home/temperature' -m '22.5' sends the message '22.5'.Click to reveal answer
Which command is used to subscribe to MQTT messages?
✗ Incorrect
The
mosquitto_sub command subscribes to topics to receive messages.How do you specify the topic in
mosquitto_pub?✗ Incorrect
The
-t option sets the topic name.What option sends the message content in
mosquitto_pub?✗ Incorrect
The
-m option specifies the message to publish.Which command would you use to listen for messages on topic 'sensor/data'?
✗ Incorrect
Use
mosquitto_sub -t sensor/data to subscribe and listen to that topic.What happens if you run
mosquitto_pub -t 'home/light' -m 'ON'?✗ Incorrect
This command sends the message 'ON' to the 'home/light' topic.
Explain how to publish a message to an MQTT topic using mosquitto_pub.
Think about how you tell the command where and what to send.
You got /3 concepts.
Describe how mosquitto_sub works to receive messages.
Focus on how you listen to messages from a topic.
You got /3 concepts.