MQTT Quality of Service (QoS)
MQTT Quality of Service is the delivery guarantee chosen for each message: QoS 0 delivers at most once, QoS 1 at least once and QoS 2 exactly once, trading reliability against network traffic and latency.
At QoS 0, the sender transmits a message once without acknowledgement, so it can be lost if a connection drops. At QoS 1, the receiver acknowledges with PUBACK and the sender retransmits until acknowledged, which guarantees delivery but can create duplicates. At QoS 2, a four-part handshake of PUBLISH, PUBREC, PUBREL and PUBCOMP ensures each message is delivered exactly once, at the cost of extra round trips and state on both sides.
QoS applies separately on each hop, between publisher and broker and between broker and each subscriber, where the delivered level is the lower of the published QoS and the subscription QoS. High-rate telemetry in which the next value soon replaces the last often uses QoS 0, while state changes, events and commands commonly use QoS 1 with idempotent handling of duplicates. QoS 2 is used where duplicates would cause errors and the overhead is acceptable.
QoS guarantees cover the MQTT session, not the end-to-end business transaction; if a client's session is not persistent, or a broker loses state without persistence, messages can still be lost. Persistent sessions, broker persistence and store-and-forward buffering at the edge complement QoS. Higher QoS levels increase traffic, latency and broker load, so they should be chosen per data type rather than globally.
Key points
- QoS 0: at most once, with no acknowledgement
- QoS 1: at least once, acknowledged with PUBACK; duplicates are possible
- QoS 2: exactly once, using a four-part handshake
- Each hop uses the lower of the published and subscribed QoS
- Combine with persistent sessions and edge buffering for reliability
Where AiVibe comes in
AiAmbA IoT is AiVibe's edge protocol layer: it discovers devices and normalises industrial signals, with supported protocols including Siemens S7, Mitsubishi MC, Delta Modbus, OPC UA and MQTT, and driver availability confirmed per installation. Writes to machines are deny-by-default.