-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue while setting keep alive zero. #1033
Comments
My guess is that some other block of code, maybe the ping mechanism is disconnecting the client and causing the connected() to return false. pubsubclient/src/PubSubClient.cpp Line 376 in 2d228f2
|
Yep, looks like keepalive 0 is not correctly respected. Try changing the following line pubsubclient/src/PubSubClient.cpp Line 373 in 2d228f2
to
I've not done any long term testing, but I'm having no issues with this change so far. |
On my esp8266, If I set the keep alive parameter to zero and connect to a broker, despite being connected to broker successfully, connected() returns false and my reconnect loop triggers automatically. I compiled the example provided in the following link : https://github.com/knolleary/pubsubclient/blob/master/examples/mqtt_esp8266/mqtt_esp8266.ino.
I just added the following line to void setup(), at the absolute bottom: client.setKeepAlive(0);
Attempting MQTT connection...connected Attempting MQTT connection...connected
This message is printed in a rapid manner, infinitely.
Am I doing something wrong? Should connected() not return true in my case?
The text was updated successfully, but these errors were encountered: