0
votes

I'm very confused when discussing about MQTT QoS.

Let's say we have a broker with two active clients, A and B. We want to publish a MQTT message from A, dedicated for client B and make sure client B, that subscribes to this topic receives this message.

I'm not sure whether QoS levels is the right tool to handle this task.

With QoS 1 or 2, does it ensure that at least one (qos=1) or exactly one (qos=2) subscriber got that message correctly, or does it acknowledge already once the broker got the message correctly? In case of the latter one, what is the meaning of QoS 1 then (since there is anyway only one broker)?

From documentations like these https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/ it is unclear to me whether the PUBACK is issued by the broker or it is forwarded from a client through the broker.

Thank you for any considerations!

1

1 Answers

2
votes

The important thing to remember about QOS handshakes is that they are only ever between a single client and the broker. There is no end to end delivery notification in MQTT.

So when client A publishes a message at say QOS 1 then the broker will respond with a PUBACK once it has received the message.

If client B is subscribed at QOS 1 then it will respond to the broker with a PUBACK once it has received the message.

These 2 sets of action are totally independant of each other.

Let's say we have a broker with two active clients, A and B. We want to publish a MQTT message from A, dedicated for client B and make sure client B, that subscribes to this topic receives this message.

You should not think this way, client A is not publishing a message to client B, but to a topic that client B just happens to be subscribed to.

You have to remember that client A knows absolutely nothing about client B at a MQTT protocol level, there may be 0 to infinite clients subscribed to the topic that A published a message to. There may also be clients with a persistent subscription to that same topic that are currently offline.