With the clear session flag set to FALSE, I am missing the published values

亡梦爱人 提交于 2019-12-01 14:12:35

In order for messages to be queued for a client that is no longer connected to a broker, these things must be true:

  • Client must have originally connected with clean session set to false
  • Client must have subscribed with QoS>0
  • Messages to that topic must have been published with QoS>0
  • When the client reconnects it must have the same client id as when it disconnected
  • When the client reconnects it must have clean session set to false

My bet is that you are failing on either of the latter two points.

You need to send the messages with the retain flag to be able to recieve the messages when you re-connect. The QoS defines how hard the broker/client will try to ensure that a message is received.

Have a read here http://mosquitto.org/man/mqtt-7.html on QOS, clean session and retained messages.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!