Session management
Overview
The Session Expiry Interval is a parameter a client sets during the CONNECT packet stage, specified in seconds. This parameter indicates the duration the broker retains the client’s session information. If this interval is set to zero, or if the CONNECT packet does not specify an expiry value, the session data is promptly deleted from the broker as soon as the client’s network connection terminates. Notably, the maximum session expiry interval is UINT_MAX
(4,294,967,295), enabling an offline session to persist for an extended duration of just over 136 years following client disconnection, reference HiveMQ.
The feature is applicable to both of the consumer and publisher transports.
Example
Session management attributes schema
These are optional attributes to control the behaviour of client session state management.
Note: To use client recoverable sessions set expiry above zero and set the clean start
attribure to false.
session expiry interval
The maximum time in seconds the broker will hold the session state for a client.
Long
Default: 0 seconds
clean start
Provide a clean restart (i.e. create a new session for the connected process).
Boolean
Default: true
Last updated
Was this helpful?