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