Open jhortwo opened 4 years ago
I assume you are setting it in PubSubClient.h
rather than your own sketch?
Hi, I set the parameters in my own sketch before include PubSubClient.h
According to PubSubClient.h, if I define MQTT_KEEPALIVE before include, override the default MQTT_KEEPALIVE 15 . ¿That's right?
El jue., 2 abr. 2020 a las 13:11, knolleary (notifications@github.com) escribió:
I assume you are setting it in PubSubClient.h rather than your own sketch?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/knolleary/pubsubclient/issues/726#issuecomment-608020092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVIF5HIGOPDXOZU5GCSESTRKTINBANCNFSM4LZZQYYQ .
If you are using the Arduino IDE then you must edit PubSubClient.h as it says in the docs.
This is because the Arduino IDE completely reorganises your #include
statements and they get moved to the top of the script that eventually gets compiled. So any #define you add will happen after the library has been included and built.
I'm using Visual Studio Code and PlatformIO with Arduino Framework. Anyway I'll try to set MQTT_KEEPALIVE in the library PubSubClient.h. Thanks so much for your help with this matter.
El jue., 2 abr. 2020 a las 18:06, knolleary (notifications@github.com) escribió:
If you are using the Arduino IDE then you must edit PubSubClient.h as it says in the docs.
This is because the Arduino IDE completely reorganises your #include statements and they get moved to the top of the script that eventually gets compiled. So any #define you add will happen after the library has been included and built.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/knolleary/pubsubclient/issues/726#issuecomment-608136927, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVIF5EU5NNGLAQ53UZQFLLRKUK7VANCNFSM4LZZQYYQ .
I think this can be closed, since we now have client.setKeepAlive() and client.setSocketTimeout() ?
Hi, first at all thank you for share your great work in this library. I just have a problem when I try to set the keepalive time at less than 15 seconds. When I set the time more than 15 seconds works well but if I set to 5 seconds or less the keepalive time stuck on 15 seconds.