1qos(3) Library Functions Manual qos(3)
2
3
4
6 qos - Quality of service The MQTT protocol provides three qualities of
7 service for delivering messages between clients and servers: 'at most
8 once', 'at least once' and 'exactly once'.
9
10 Quality of service (QoS) is an attribute of an individual message being
11 published. An application sets the QoS for a specific message by
12 setting the MQTTClient_message.qos field to the required value.
13
14 A subscribing client can set the maximum quality of service a server
15 uses to send messages that match the client subscriptions. The
16 MQTTClient_subscribe() and MQTTClient_subscribeMany() functions set
17 this maximum. The QoS of a message forwarded to a subscriber thus might
18 be different to the QoS given to the message by the original publisher.
19 The lower of the two values is used to forward a message.
20
21 The three levels are:
22
23 QoS0, At most once: The message is delivered at most once, or it may
24 not be delivered at all. Its delivery across the network is not
25 acknowledged. The message is not stored. The message could be lost if
26 the client is disconnected, or if the server fails. QoS0 is the fastest
27 mode of transfer. It is sometimes called 'fire and forget'.
28
29 The MQTT protocol does not require servers to forward publications at
30 QoS0 to a client. If the client is disconnected at the time the server
31 receives the publication, the publication might be discarded, depending
32 on the server implementation.
33
34 QoS1, At least once: The message is always delivered at least once. It
35 might be delivered multiple times if there is a failure before an
36 acknowledgment is received by the sender. The message must be stored
37 locally at the sender, until the sender receives confirmation that the
38 message has been published by the receiver. The message is stored in
39 case the message must be sent again.
40
41 QoS2, Exactly once: The message is always delivered exactly once. The
42 message must be stored locally at the sender, until the sender receives
43 confirmation that the message has been published by the receiver. The
44 message is stored in case the message must be sent again. QoS2 is the
45 safest, but slowest mode of transfer. A more sophisticated handshaking
46 and acknowledgement sequence is used than for QoS1 to ensure no
47 duplication of messages occurs.
48
49
50
51Paho MQTT C Client Library Thu Jul 22 2021 qos(3)