philbowles / PangolinMQTT

PangolinMQTT - ArduinoIDE client library for ESP8266, ESP32 and STM32-NUCLEO
Other
70 stars 22 forks source link

How can I see if all messages have been published? #41

Open drmattoclarkson opened 3 years ago

drmattoclarkson commented 3 years ago

I have some code that publishes some messages then puts the esp8266 to sleep - how can I tell that all messages have been sent and it's safe to sleep?

HamzaHajeir commented 2 years ago

Hi

I share the same issue, where onPublish callback is further needed for qos levels 1 and 2, however, to checkout the author's opinion, here's a link to the documentation at the time he did remove it: https://github.com/philbowles/PangolinMQTT/blob/ff68b5ff114d35c5b873da02e9761f91fafda15f/docs/api.md#specific-problems--fixes

HamzaHajeir commented 2 years ago

I think you can do the following:

HamzaHajeir commented 1 year ago

It's solved in my fork of H4AsyncMQTT, you receive the PacketID for QoS>0 publishes at ::publish(), and receive the ACK'd PacketID onPublish() callback function.