paho.mqtt.java icon indicating copy to clipboard operation
paho.mqtt.java copied to clipboard

JavaDoc about sessionExpiryInterval in MQTT 5 client is incorrect

Open jbertram opened this issue 4 years ago • 0 comments

  • [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)

The JavaDoc on org.eclipse.paho.mqttv5.client.MqttConnectionOptions#setSessionExpiryInterval states (in part):

By default this value is null and so will not be sent, in this case, the session will not expire.

However section 3.1.2.11.2 of the MQTT 5 specification states:

If the Session Expiry Interval is absent the value 0 is used. If it is set to 0, or is absent, the Session ends when the Network Connection is closed.

If the Session Expiry Interval is 0xFFFFFFFF (UINT_MAX), the Session does not expire.

The JavaDoc on org.eclipse.paho.mqttv5.client.MqttConnectionOptions#setSessionExpiryInterval should be corrected to reflect the behavior defined in the specification. It would also probably be useful to make org.eclipse.paho.mqttv5.common.packet.MqttDataTypes#FOUR_BYTE_INT_MAX public and reference that in the JavaDoc as an easy way to ensure the session does not expire.

jbertram avatar Apr 21 '21 16:04 jbertram