本文介绍了mqtt.js排队的发布消息数不超过65535的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试使用 https://www.npmjs.com/package/mqtt 模拟大量发布,并发现该队列一次最多容纳65535条消息. (如果我尝试发送更多邮件,其余的邮件将被丢弃)是否有此原因,并且有任何解决方法吗?
I've been trying to use https://www.npmjs.com/package/mqtt to simulate a large number of publishes and found that the queue does not hold more than 65535 messages at a time. (If I try to send more, the remaining are discarded) Is there a reason for this and are there any workarounds?
推荐答案
因为这是MQTT中允许的最大数据包ID数规范
Because that is the maximum number of packet ids allowed in the MQTT spec
数据包ID是一个16位数字(最大65535),并且对于所有机上消息都必须是唯一的.
Packet ids are a 16bit number (max 65535) and must be unique for all inflight messages.
这篇关于mqtt.js排队的发布消息数不超过65535的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!