hirotakaster / MQTT

MQTT for Photon, Spark Core
Other
216 stars 118 forks source link

Does QOS2 also queue messages if connection is gone while publishing the QOS2 message? #65

Open kenvernaillenvub opened 6 years ago

kenvernaillenvub commented 6 years ago

When I publish a certain message while internet is down, it should be queued and sent later on. Is this already implemented in QOS2? If it is QOS2, will this keep trying to send it? Because the first line in MQTT::publish is if (isConnected()) { and I think it will automatically return false and don't send it. What is the best way to make sure I don't lose any QOS2 messages?

hirotakaster commented 6 years ago

@kenvernaillenvub Hi, this lib don't store message on QoS=2. Instead of store the message, you can use the QoS2 message callback function(addQosCallback) for check the message really sent or not on your application.

mkesselaers commented 5 years ago

Hi,

I have a similar request. How would you tackle this? Using the callback would mean that you would need to build a dict if you have multiple QOS2-messages that need to be pushed.

I'm quite new to MQTT so if you could provide an example, I would be forever grateful

Thanks, Maarten

hirotakaster commented 5 years ago

hi @kenvernaillenvub This library don't have like a message queue or re-send message. If you want to use multiple QoS2 message, you have to manage QoS2 message id by yourself.