0
0
IOT Protocolsdevops~5 mins

mosquitto_pub and mosquitto_sub commands in IOT Protocols - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Amosquitto_sub
Bmosquitto_pub
Cmqtt_subscribe
Dmqtt_publish
How do you specify the topic in mosquitto_pub?
A-m
B-t
C-p
D-q
What option sends the message content in mosquitto_pub?
A-m
B-t
C-s
D-c
Which command would you use to listen for messages on topic 'sensor/data'?
Amosquitto_pub -t sensor/data
Bmosquitto_sub -t sensor/data
Cmosquitto_pub -m sensor/data
Dmosquitto_sub -m sensor/data
What happens if you run mosquitto_pub -t 'home/light' -m 'ON'?
AIt subscribes to the 'home/light' topic.
BIt publishes the message 'ON' to the 'home/light' topic.
CIt starts the MQTT broker.
DIt deletes 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.