If Server Keep Alive is set to 1/2 +1 (or more) ClientState.checkForActivity will issue a pingreq and adapts to the change. However, a Server Keep Alive of 1/2 or less of ConnectionOptions.keepAliveInterval will always result in ClientState.checkForActivity throwing, because the timer is set before the client considers the ConnectAck:ServerKeepAlive, but the check is done considering the new value (which indicates tardiness).
According to the spec the client is expected to:
If the Server sends a Server Keep Alive on the CONNACK packet, the Client MUST use this value instead of the Keep Alive value the Client sent on CONNECT
It is the responsibility of the Client to ensure that the interval between MQTT Control Packets being sent does not exceed the Keep Alive value
[x] Bug exists Release Version 1.2.5 ( Master Branch)
[ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
[x] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
If
Server Keep Alive
is set to 1/2 +1 (or more)ClientState.checkForActivity
will issue apingreq
and adapts to the change. However, aServer Keep Alive
of 1/2 or less ofConnectionOptions.keepAliveInterval
will always result inClientState.checkForActivity
throwing, because the timer is set before the client considers theConnectAck:ServerKeepAlive
, but the check is done considering the new value (which indicates tardiness).According to the spec the client is expected to: