Glossary · Industrial communication
Persistent session (MQTT)
Also known as: MQTT session, Persistent session
German: Persistente Sitzung (MQTT)
In MQTT, a persistent session is session state that the broker keeps for a client identifier beyond a single connection, including its subscriptions and the QoS 1 and QoS 2 messages it has not yet received, requested with Clean Session = 0 in MQTT 3.1.1 or with Clean Start = 0 and a session expiry interval in MQTT 5.0.
- Industrial communication
- Standards
In one sentence
A persistent MQTT session keeps a client's subscriptions and pending QoS 1/2 messages on the broker across reconnects.
Example
The historian of a packaging line connects with a fixed client ID and a one-hour session expiry, so the broker queues the QoS 1 production counts published while the historian is restarted and delivers them afterwards.
How it applies
- Design: Only messages with Quality of service (QoS) 1 or 2 are queued; QoS 0 messages published while the client is offline are lost. The client must reconnect with the same client identifier to resume its session.
- MQTT 3.1.1 vs. 5.0: In 3.1.1, Clean Session = 0 keeps the session indefinitely. In 5.0, Clean Start and the session expiry interval are separate: the client can resume an existing session and still limit how long the broker keeps it.
- Operations: Queued messages use broker memory and storage. Sessions of decommissioned clients should expire, and queue limits decide what happens when a client stays offline for long.
- Documentation: The documentation team documents which clients use persistent sessions, their client identifiers, session expiry, the QoS of the subscribed topics and the broker's queue limits, so it is clear what data survives an outage.
Persistent session vs. store-and-forward
A persistent session buffers on the broker for a disconnected subscriber. Store-and-forward usually means buffering at the edge when the publisher can't reach the broker; both are often needed for gap-free data.