Bird
0
0

In an MQTT-based smart home system, how can you ensure that a device's unexpected disconnection is detected and handled?

hard🚀 Application Q9 of 15
Raspberry Pi - MQTT for IoT
In an MQTT-based smart home system, how can you ensure that a device's unexpected disconnection is detected and handled?
ADisable clean session flag
BSet QoS to 0 for all messages
CSubscribe to all topics with wildcard '#'
DUse Last Will and Testament (LWT) messages
Step-by-Step Solution
Solution:
  1. Step 1: Understand device disconnection detection

    MQTT's Last Will and Testament sends a message if a client disconnects unexpectedly.
  2. Step 2: Evaluate other options

    QoS 0 doesn't help detect disconnection; wildcard subscription and clean session don't detect disconnects.
  3. Final Answer:

    Use Last Will and Testament (LWT) messages -> Option D
  4. Quick Check:

    MQTT LWT detects unexpected disconnects = Use Last Will and Testament (LWT) messages [OK]
Quick Trick: LWT messages notify broker of unexpected disconnects [OK]
Common Mistakes:
MISTAKES
  • Thinking QoS controls disconnect detection
  • Believing wildcard subscription detects disconnects
  • Confusing clean session with disconnect handling

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes