-->
Page 2 of 13

Re: Possible replacement MQTT library

PostPosted: Sun Aug 16, 2020 3:07 pm
by urs_eppenberger
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.

Re: Possible replacement MQTT library

PostPosted: Tue Aug 18, 2020 4:54 am
by urs_eppenberger
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.

Re: Possible replacement MQTT library

PostPosted: Tue Aug 18, 2020 11:44 pm
by Pablo2048
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

Re: Possible replacement MQTT library

PostPosted: Fri Aug 21, 2020 4:55 am
by eriksl
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).