mosquitto的qos

MQTT defines three levels of Quality of Service (QoS). The QoS defines how hard the broker/client will try to ensure that a message is received. Messages may be sent at any QoS level, and clients may attempt to subscribe to topics at any QoS level. This means that the client chooses the maximum QoS it will receive. 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. If a second client is also subscribed to the same topic, but with QoS 2, then it will receive the same message but with QoS 2. For a second example, if a client is subscribed with QoS 2 and a message is published on QoS 0, the client will receive it on QoS 0.

Higher levels of QoS are more reliable, but involve higher latency and have higher bandwidth requirements.

0: The broker/client will deliver the message once, with no confirmation.

1: The broker/client will deliver the message at least once, with confirmation required.

2: The broker/client will deliver the message exactly once by using a four step handshake.
MQTT定义了三个级别的服务质量(QoS)。QoS定义了代理/客户端尝试确保消息被接收的难度。消息可以在任何QoS级别发送,客户端可以尝试订阅任何QoS级别的主题。这意味着客户端选择它将接收到的最大QoS。例如,如果消息以QoS 2发布,而客户端以QoS 0订阅,则消息将被发送到具有QoS 0的客户端。如果第二个客户端也订阅了相同的主题,但具有QoS 2,那么它将接收相同的消息,但具有QoS 2。对于第二个示例,如果客户端订阅了QoS 2,并且在QoS 0上发布了消息,则该客户端将在QoS 0上接收该消息。

更高级别的QoS更可靠,但涉及更高的延迟和更高的带宽需求。

0:代理/客户端只传递一次消息,不需要确认。

1:代理/客户端将至少传递一次消息,并需要确认。

2:代理/客户端将通过使用四步握手来准确地传递消息一次。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值