当订阅者重新连接时,mosquitto 不会重新发送消息

mosquitto does not resend message when subscriber reconnects

我正在使用 eclipse paho 和 mosquitto。我正在发送 QOS-1 级别的消息。我已经按照 question.I 中的回答更改了 mosquitto 配置,我正在使用 mqtt lens 进行测试。 Mosquitto 在订阅者断开和连接后不发送消息。

将 clean session 设置为 true 将告诉代理删除任何排队等待客户端的消息。

如果您想接收为该客户端排队的任何消息,您需要将其设置为 false

HiveMQ 的人有一篇博客 post 关于使用 MQTT 的持久会话和消息队列:http://www.hivemq.com/blog/mqtt-essentials-part-7-persistent-session-queuing-messages