Qos means "quality of service"
. It defined whether is message is stable. Different with DDS (qos 7 levels), mqtt has 3 levels
which are 0, 1, 2
.
- qos0: at least 0 time. In brief, just send, do not care whether received.
- qos1: at least once.
- qos2: confirm exactly once.
It is better to use mqtt first to better understand what it could do for us.
-
- And then you could install
mosquitto-clients
(sudo apt install mosquitto-clients
on ubuntu) to test the communication betweensubscriber mosquitto_sub
andpublisher mosquitto_pub
. If you want to develop some demos by yourself there is a project that you could refer.
- And then you could install
- The qos could be defined both on
sub
andpub
side. So the different combinations are as below.
P(QOS0)、S(QOS0)
P(QOS0)、S(QOS1)
P(QOS0)、S(QOS2)
P(QOS1)、S(QOS0)
P(QOS1)、S(QOS1)
P(QOS1)、S(QOS2)
P(QOS2)、S(QOS0)
P(QOS2)、S(QOS1)
P(QOS2)、S(QOS2)
But as I test, if( S(QOS) > P(QOS) ) { S(QOS) = P(QOS) ;}
. So actually, there are only 6 combinations.
P(QOS0)、S(QOS0)
P(QOS1)、S(QOS0)
P(QOS1)、S(QOS1)
P(QOS2)、S(QOS0)
P(QOS2)、S(QOS1)
P(QOS2)、S(QOS2)
- Lets use wireshark to check what happens.
Subscriber | Publisher | Broker | |
---|---|---|---|
ip | 10.30.64.129 | 10.30.64.129 | 103.39.213.201 |