> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clariodesk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Realtime

> Agent replies, status changes, presence, and read receipts stream to the device live.

Reads in ClarioDesk are live, so you don't poll the backend. The SDK holds a
realtime connection and pushes updates into your streams (Flutter),
subscriptions and hooks (React Native), or `AsyncStream`s (Swift) as they
happen.

## Transport

The SDK connects over Centrifugo by default and falls back to SSE (Server-Sent
Events) automatically when Centrifugo isn't reachable. The connection handshake
is signed by the device key, same as every other authenticated request. You
don't configure any of this. It's on by default.

## Connection state

You can observe the connection so your UI can show an offline banner or a
reconnecting spinner. The state machine is:

| State          | Meaning                                           |
| -------------- | ------------------------------------------------- |
| `connecting`   | First connection attempt in progress.             |
| `connected`    | Live; updates are streaming.                      |
| `reconnecting` | Dropped; automatically retrying with backoff.     |
| `disconnected` | Not connected (e.g. app backgrounded).            |
| `fatal`        | Unrecoverable (e.g. device revoked); won't retry. |

<CodeGroup>
  ```dart Flutter theme={null}
  ClarioDesk.connectionStream().listen((state) {
    // 'connecting' | 'connected' | 'reconnecting' | 'disconnected' | 'fatal'
  });
  ```

  ```ts React Native theme={null}
  const conn = useConnection(); // or ClarioDesk.subscribeConnection(cb)
  ```
</CodeGroup>

## What streams live

* **Messages:** agent replies appear in the open thread instantly.
* **Tickets:** status changes and unread indicators update in the inbox.
* **Typing:** whether a support agent is currently typing.
* **Agent presence:** whether an agent is online.
* **Read receipts:** when the agent has seen the user's message.

## Optimistic sends & the offline outbox

Writes are optimistic. A message you send appears immediately as pending
("sending…"). On success it settles; on rejection it's marked failed so you can
render tap-to-retry. A send made while offline stays pending and auto-flushes on
reconnect via a durable outbox, so nothing is lost if the network drops
mid-send.

See the per-SDK API references for the exact flags and retry method
([Flutter](/flutter/api-reference), [React Native](/react-native/api-reference),
[Swift](/swift/api-reference)).
