MQTT and connected devices
The protocol of sensors and connected devices: publish and subscribe through a broker, topics, delivery guarantees, retained messages and the last will.
- 40 cards
- 3 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Publish and subscribe
- Delivery guarantees
- Surviving failures
A few cards from the deck
What is MQTT?
Show the answer
A lightweight publish and subscribe protocol over TCP, designed for connected devices and unreliable networks.
Its headers are only a few bytes and one connection stays open: ideal for a battery-powered sensor.
A sensor sends the temperature every 10 seconds; losing a reading is no big deal. Which QoS?
- QoS 1
- QoS 2
- An e-mail per reading
- QoS 0
Show the answer
QoS 0
The next reading comes soon: no point paying for acknowledgements.
Use QoS 2 everywhere?
Show the answer
The guarantee is strong, but it takes 4 messages per publication: more latency and energy. Keep it for the cases that need it.
QoS is chosen per message: only commands a duplicate would make dangerous need level 2.
Publishing a reading in QoS 1: after “CONNECT with client ID, keep-alive and last will”, what is the next message?
- SUBACK
- PUBLISH home/livingroom/temperature 21.5 in QoS 1
- CONNACK
- SUBSCRIBE home/+/temperature
Show the answer
CONNACK
The broker accepts the connection. → Session open