MQTT in Practice: Topics, QoS and Retained Messages
Most people meet MQTT as a name. Three ideas, topics, quality of service and retained messages, explain how it behaves in a real project.
3 min read · 2 March 2026
Topics are the addressing
Every message is published to a named topic such as site1/floor2/room5/temperature, and subscribers choose topics they care about, including with wildcards. A clear, consistent topic structure is the single most important design decision, because it is hard to change once many devices use it.
Quality of service levels
QoS 0 sends a message at most once with no confirmation, QoS 1 guarantees at least once and QoS 2 exactly once at the price of more traffic. Sensor readings that repeat every minute usually use 0 or 1; commands that must not be duplicated may justify 2.
Retained messages and last will
A retained message is stored by the broker and delivered to any new subscriber, so a dashboard that starts up sees the last known value at once. A last-will message lets the broker announce that a device has disappeared, which is a simple way to detect offline equipment.
Design habits that save trouble
Agree naming conventions, document the payload format, keep messages small and avoid putting secrets in topics. Decide who may publish and subscribe to what, and test behaviour when devices reconnect after a network break.
Related guides
Choosing and Securing an MQTT Broker
The broker is the centre of an MQTT system. How to pick one and what must be locked down before devices connect.
Read the guideModbus RTU vs Modbus TCP: What Changes on the Wire
The same register model travels over two very different transports. Knowing which you have saves hours of debugging.
Read the guideBACnet/IP vs BACnet MS/TP: Choosing the Right Link
BACnet appears in two main forms. They behave differently and suit different parts of a building.
Read the guideTalk it through with an expert.
Or call +91 72000 13579 · Mon–Sat, 10:00 AM – 6:00 PM