mqtt.js 排队的发布消息不超过 65535 条

mqtt.js does not queue more than 65535 publish messages

我一直在尝试使用 https://www.npmjs.com/package/mqtt 模拟大量发布,发现队列一次容纳的消息不超过 65535 条。 (如果我尝试发送更多,剩余的将被丢弃)这是否有原因,是否有任何解决方法?

因为这是 MQTT 中允许的最大数据包 ID 数 spec

数据包 ID 是一个 16 位数字(最大 65535)并且对于所有飞行消息必须是唯一的。

SUBSCRIBE, UNSUBSCRIBE, and PUBLISH (in cases where QoS > 0) Control Packets MUST contain a non-zero 16-bit Packet Identifier [MQTT-2.3.1-1]. Each time a Client sends a new packet of one of these types it MUST assign it a currently unused Packet Identifier [MQTT-2.3.1-2]. If a Client re-sends a particular Control Packet, then it MUST use the same Packet Identifier in subsequent re-sends of that packet. The Packet Identifier becomes available for reuse after the Client has processed the corresponding acknowledgement packet. In the case of a QoS 1 PUBLISH this is the corresponding PUBACK; in the case of QoS 2 it is PUBCOMP. For SUBSCRIBE or UNSUBSCRIBE it is the corresponding SUBACK or UNSUBACK [MQTT-2.3.1-3]. The same conditions apply to a Server when it sends a PUBLISH with QoS > 0 [MQTT-2.3.1-4].