Skip to content

Quality of Service (QoS) ​

QoS sets the delivery guarantee of a message. ConnectMQ supports QoS 0, 1 and 2 on every plan.

The three levels ​

QoS 0: at most onceQoS 1: at least onceQoS 2: exactly once
DeliveryMay be lostNever lost while connected, may arrive twiceArrives exactly once
HandshakeNonePUBLISH → PUBACKPUBLISH → PUBREC → PUBREL → PUBCOMP
CostLowestLowHighest (four packets)
Use forFrequent readings where the next one replaces a lost oneMost telemetry, events and alarmsCommands and billing events where a duplicate does harm

QoS 1 is the right default for most devices. Make your consumers tolerate duplicates (for example by ignoring a message with the same timestamp twice) and you rarely need QoS 2.

Publish QoS and subscribe QoS ​

QoS applies to each hop separately:

  1. Publisher → broker: the QoS of the PUBLISH.
  2. Broker → subscriber: the lower of the message's QoS and the subscription's QoS.

A message published with QoS 1 to a subscriber that subscribed with QoS 0 is delivered with QoS 0.

Why QoS 1 helps while testing ​

When a message breaks a rule (too large, too many per second, too many topic levels, denied by ACL, or the monthly traffic is used up), the broker drops it:

  • QoS 0: the publisher is not told.
  • QoS 1 and 2 with MQTT 5: the PUBACK or PUBREC carries the reason code, for example 0x97 Quota exceeded or 0x87 Not authorized (reason codes).

Publish with QoS 1 while you set up a device, so problems surface in your client's log.

In-flight messages ​

A client may only have a limited number of QoS 1/2 messages waiting for acknowledgement at the same time: up to 100 on paid plans and 16 on the public test broker. The broker sends the exact value in the CONNACK as MQTT 5 Receive Maximum, and most libraries respect it automatically. A client that sends more is disconnected with 0x97 Quota exceeded.

QoS and offline clients ​

QoS guarantees delivery between a client and the broker while they are connected. ConnectMQ does not keep messages for clients that are offline (sessions): use retained messages for the latest state, and buffering on the publisher side (for example the ConnectMQ Edge offline buffer) for data that must survive an outage.

Fully managed MQTT broker for connected devices.