Non-blocking connection with Cayenne

the code works fine but there are some changes needed:

  1. They can still specify the 5 as the default value in the function definition. So users will not have to set it. Only the ones who need it would. For example:
    void connect(size_t maxRetries=5)
    That way example code stays the same, but if a user wanted a specific retry count they could pass it as a parameter.
    2)Also, don’t use global variables error_count

Sorry, i beginner in write library. And I don 't know how to do it?

I rewrite file. For use restriction reconnect, it’s necessary write in arduino sketch file
#define maxRetries 2 // max counter of reconnect
#include <CayenneMQTT*.h>

CayenneArduinoMQTTClient .txt (19.3 KB)

Let me check it out

After some day, one bug.
If i use Cayenne library, for connect to wifi, it’s not stab reconnect.
Library wrote “connect to ssid” and freeze.
If i use for connect, wifi library, it’s work good

the cayenne library is based on wifi library. so using it separately does not make a difference.

Seems like this issue is not fixed yet?
Is kang2k code ready to be used? Or did You (Cayenne) issue any official update of Cayenne MQQT library?

I’m interested only in battery powered devices in noisy wifi environment and “blocking mode” is not acceptable.
Blynk can be connected in non-blocking mode, why not Cayenne?

Have a look at my thread here Battery Powered ESP8266 Temperature/Humidity Monitor with DHT11

1 Like