I am new to MQTT and I just learned about the meaning of the QOS level that is decided when a message is published:
- 0 when we prefer that the message will not arrive at all rather than arrive twice
- 1 when we want the message to arrive at least once but don't care if it arrives twice (or more)
- 2 when we want the message to arrive exactly once. A higher QOS value means a slower transfer
I noticed that the subscriber side can also set the "Maximum QOS level they will receive". Quoting from here:
For example, if a message is published at QoS 2 and a client is subscribed with QoS 0, the message will be delivered to that client with QoS 0.
Does this mean that the message might not arrive to the client (QOS 0) despite the fact that publisher sent it with QOS 2?
This might be a big issue among inexperienced developers - for example, the default QOS of the subscribe function in the npm mqtt package is 0! (The default should have been the maximum value 2 in my opinion, i.e. "let the publisher decide the QOS").