Open kunaltakalkar opened 8 months ago
If you have a keepalive interval of 30 seconds, then if there is no other traffic, a PINGREQ will be sent every 30 seconds. If the connection is broken soon after a PINGREQ is sent and the PINGRESP received, it will be another 30 seconds until the next PINGREQ is sent. Then another 45 seconds before the connection is recognized as lost. So I think this is possible.
As per mqtt specification, broker follows 1.5x KeepAlive. Shouldn't that be same on the client and be consistent with the specification? Please correct me if my understanding is wrong.
Describe the bug
I am using the following Libraries: paho.mqtt.c-1.3.13, paho.mqtt.cpp-1.3.2 I have set KeepAlive to 20secs. If the internet is disconnected during the PUBLISH calls (small chunks of data), the connectionLost is received after ~50secs (2.5xKeepAlive).
To Reproduce
Observed behavior connectionLost is received after ~50 secs (2.5xKeepAlive)
Expected behavior connectionLost should be received within 30 secs (1.5xKeepAlive)
Screenshots NA
Log files Logs are attached here: Paho_Keepalive_Issue.txt
Environment (please complete the following information):
Additional context async_publish example was modified to simulate the behavior. Its attached to the ticket. async_publish.cpp.txt