Concept: Session Resumption
Back to overview
When and how to reconnect a session.
Description
Session resumption happens, when a new connection for an existing session
is established.
Reconnect Types
We differentiate between two types of session resumption: A wakeup and a
full reconnect:
- Full Reconnect: During a full reconnect, the
chunk cache SHALL NOT be used. All initial
messages MUST be sent again and the connection is treated as if the
session were newly created.
- Wakeup: When doing a wakeup, the initial messages SHALL NOT be sent
again. The chunk cache MUST be transferred
from the previous connection to the new connection (both identified
with a unique connection ID) See
sequence number for more details.
Reconnect Triggers
Session resumption SHALL be triggered in one of the following cases:
Triggered by App
- A session is currently active, but disconnected, and
- an outgoing message to the client is enqueued.
As an example, when a new incoming Threema message from a contact
arrives, that will result in a new update/messages
message
being enqueued for the client. If at that point in time a session is
active but not connected, session resumption will be triggered.
Triggered by Push
- A wakeup push message arrives.
Triggered Manually
- The user manually starts the session from the Threema app.