Choosing a quality of service
We then need to choose a Quality of Service. There are three to choose from: At most once, At least once, and Exactly once. At most once is the simplest, and requires only one MQTT packet to be sent for each publication. But the publication is not guaranteed to be received; it can be lost in transit. Since we regularly update our sensor data, we choose this service. It doesn't negatively affect system performance a great deal if packets are lost, and we avoid unnecessary control packets.
If you want to safeguard against accidental losses, you can use the At least once service instead. When such a packet is received, an Acknowledgement is returned as a receipt. The original packet is resent until an acknowledgement ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access