0
0
IOT Protocolsdevops~10 mins

mosquitto_pub and mosquitto_sub commands in IOT Protocols - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to publish a message 'Hello' to topic 'test/topic' using mosquitto_pub.

IOT Protocols
mosquitto_pub -t [1] -m "Hello"
Drag options to blanks, or click blank then click option'
Amqtt/topic
Bhello/world
Ctest/topic
Dtopic/test
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong topic name.
Confusing the topic with the message.
2fill in blank
medium

Complete the command to subscribe to the topic 'sensor/data' using mosquitto_sub.

IOT Protocols
mosquitto_sub -t [1]
Drag options to blanks, or click blank then click option'
Adata/sensor
Bsensor/data
Csensor/info
Ddata/sensors
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping words in the topic name.
Using a similar but incorrect topic.
3fill in blank
hard

Fix the error in the command to publish message 'Data' to topic 'home/room' with QoS level 1.

IOT Protocols
mosquitto_pub -t home/room -m Data -q [1]
Drag options to blanks, or click blank then click option'
A1
B2
C0
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid QoS levels like 3.
Confusing QoS with other options.
4fill in blank
hard

Fill both blanks to subscribe to topic 'alerts' with verbose output and clean session disabled.

IOT Protocols
mosquitto_sub -t [1] [2]
Drag options to blanks, or click blank then click option'
Aalerts
B-v
C-c
D--clean-session
Attempts:
3 left
💡 Hint
Common Mistakes
Using --clean-session which enables clean session.
Not using verbose mode when needed.
5fill in blank
hard

Fill all three blanks to publish message 'Update' to topic 'device/status' with retain flag and QoS 2.

IOT Protocols
mosquitto_pub -t [1] -m [2] [3] -q 2
Drag options to blanks, or click blank then click option'
Adevice/status
B"Update"
C-r
D-d
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the message.
Using -d which enables debug mode instead of retain.