With The Clear Session Flag Set To False, I Am Missing The Published Values
Is anyone has a logical explanation why despite I have the clear session flage = false I do not receive the updated published message I am subscribed to while i am not connected to
Solution 1:
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.
Solution 2:
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.
Post a Comment for "With The Clear Session Flag Set To False, I Am Missing The Published Values"