Advanced Users can post their questions and comments here for the not so Newbie crowd.

Moderator: eriksl

User avatar
By urs_eppenberger
#88336 Thanks for the link to the MQTT library.
Currently I'm using an async MQTT library:

I changed all my code to work with events and callbacks:
WiFi-connected
Wifi-disconnected
MQTT-connected
MQTT-disconnected
MQTT-event

It makes the program logic easier to understand.

But I'm no great coder at all. I just use what I find and understand more or less.
Last edited by urs_eppenberger on Tue Aug 18, 2020 1:29 pm, edited 1 time in total.
User avatar
By urs_eppenberger
#88348 About a year ago I moved to async MQTT which requires async TCP:
https://github.com/marvinroger/async-mqtt-client

I like the concept of event based actions. No more loops waiting for WiFi to start etc.

Currently I'm moving to a newer MQTT library which is async too:
https://github.com/philbowles/PangolinMQTT
Can't say anything about that from personal experience yet.

Kind regards,
Urs.
User avatar
By Pablo2048
#88366 Beware of blindly switching from async-mqtt to PangolinMQTT. The library is in early state and has it's own problems/differences for example:
1. It can be used only as an singleton
2. It hangs the whole system when you put in bad credentials by mistake or when SSL certificate expire
3. memory fragmentation is bigger
4. because of point 3 and internal bug inside the library the getMaxPayloadSize() function is unreliable after some time
5. string payload handling is incompatible with the rest of the world
User avatar
By eriksl
#88409
urs_eppenberger wrote:About a year ago I moved to async MQTT which requires async TCP:
I like the concept of event based actions. No more loops waiting for WiFi to start etc.

Looks like you're using the RTOS sdk. Using the NONOS sdk, you'll have to do it that way anyway (asynchronously), because you can't use busy waiting loops (which are evil anyway, in my opinion).