0
0
IOT Protocolsdevops~10 mins

Wildcard subscriptions (+ and #) 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 code to subscribe to all topics under 'home/kitchen' using a single-level wildcard.

IOT Protocols
client.subscribe("home/kitchen/[1]")
Drag options to blanks, or click blank then click option'
A*
B#
C+
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '#' instead of '+' subscribes to all subtopics recursively, not just one level.
2fill in blank
medium

Complete the code to subscribe to all topics under 'home' recursively using a multi-level wildcard.

IOT Protocols
client.subscribe("home/[1]")
Drag options to blanks, or click blank then click option'
A#
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' instead of '#' subscribes only to one level, missing deeper topics.
3fill in blank
hard

Fix the error in the subscription to match all topics under 'office' and its subtopics.

IOT Protocols
client.subscribe("office/[1]")
Drag options to blanks, or click blank then click option'
A+/#
B+
C#/+
D#
Attempts:
3 left
💡 Hint
Common Mistakes
Placing '#' in the middle of the topic filter causes syntax errors.
4fill in blank
hard

Fill both blanks to subscribe to all sensors in any room under 'building1'.

IOT Protocols
client.subscribe("building1/[1]/[2]")
Drag options to blanks, or click blank then click option'
A+
Bsensors
C#
Droom
Attempts:
3 left
💡 Hint
Common Mistakes
Using '#' in the middle of the topic filter is invalid.
5fill in blank
hard

Fill all three blanks to subscribe to all temperature readings in any floor and any room under 'campus'.

IOT Protocols
client.subscribe("campus/[1]/[2]/[3]")
Drag options to blanks, or click blank then click option'
A+
Btemperature
Dfloor
Attempts:
3 left
💡 Hint
Common Mistakes
Using '#' instead of '+' for room level subscribes too broadly.