Using mqtt_as and trying to publish just before client close called? #11264
Replies: 2 comments
-
I don't think this is possible using To do this I think you'll need to use synchronous code and adapt the official synchronous driver. |
Beta Was this translation helpful? Give feedback.
-
Not surprised by your comment, I think it was what I was expecting to hear. I can live with the will message as notification of shutdown/reboot on MQTT subscriber side. It would have been nice to communicate a bit more actively. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an ESP32 based micropython script that publishes as it starts and as it stops. Started after boot, and Stopped as Keyboard interrupt or script exit due to error, i.e. finally section publish.
The startup publish works fine. I setup the client, do subscribes, then publish the script is listening for messages. However, the not listening or script is ending, publish never gets to the broker. On restart of E$P32 I do get the 'will' publish from the broker. I have tried a couple of things.
In traditional python I did this via a thread and queue, and thread does not exit until the queue is empty. But using asyncio, methods, not working. Each publish is invoked via create_task asyncio method. So I thought using an await asychio,sleep sufficiently long delay would let the in progress publish task complete? But apparently not so?
Beta Was this translation helpful? Give feedback.
All reactions