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

# Live streaming

> Tail Hookie events in real time over SSE or WebSocket, with resume.

Watch events as they arrive — over **Server-Sent Events** or a **WebSocket**. Use it for live dashboards, tailing, and dev feedback.

<Warning>
  Best-effort & lossy by design — the durable delivery guarantee is signed outbound webhooks. Use the stream to *observe*, not to guarantee receipt.
</Warning>

## Server-Sent Events

```bash theme={null}
# Server-Sent Events — key in the Authorization header
curl -N https://app.hookie.ai/v1/stream \
  -H "Authorization: Bearer ik_live_xxx"
```

Each event is an SSE frame; a control frame signals a gap if you resumed past the buffer:

```http theme={null}
id: 4217
data: {"seq":4217,"id":"9d3f…","dataset":"leads","received_at":"2026-07-10T12:00:00.000Z","data":{"email":"ada@example.com"}}

event: stream-gap
data: {"missed_from":4000,"resume_from":4180}
```

## In the browser

```js theme={null}
// Browsers can't set headers on EventSource, so pass the key as ?key=
const es = new EventSource("https://app.hookie.ai/v1/stream?key=ik_live_xxx");

es.onmessage = (e) => {
  const event = JSON.parse(e.data); // { seq, id, dataset, received_at, data }
  console.log(event.dataset, event.data);
};

// The browser auto-resends Last-Event-ID on reconnect; a gap surfaces here:
es.addEventListener("stream-gap", (e) => {
  const gap = JSON.parse(e.data); // { missed_from, resume_from }
  console.warn("missed events", gap.missed_from, "→", gap.resume_from);
});
```

## Resume

The buffer holds roughly the last 1,000 events (up to \~5 minutes). Resume from where you left off with the `Last-Event-ID` header (SSE sends it automatically on reconnect) or the `?after_seq=` query parameter. If your resume point has already aged out, Hookie emits a `stream-gap` event with the range you missed, then continues live.

## WebSocket

```bash theme={null}
# WebSocket — same endpoint, Upgrade header (resume with ?after_seq=)
wscat -c "wss://app.hookie.ai/v1/stream?key=ik_live_xxx&after_seq=4180"
```

## From the console

Signed-in users get the same stream over the session-authenticated `/admin/api/stream` endpoint — no ingest key required, same SSE and WebSocket behaviour, same resume. It is the endpoint to point a dashboard of your own at when you already have a browser session and would rather not mint an ingest key for it.

The console itself does *not* tail it. Its views read what has already landed: **Datasets** for routed records, and **Observability** for paged search across records, the raw submissions behind them, deliveries and AI runs — plus the correlation lookup that stitches one id's whole chain together. Refresh to see new arrivals.

## Limits

* Concurrent connections are capped per plan (Free: 1, Pro: 5, Team: 20).
* Authenticate with any active ingest key for the tenant (read-only tail; it never exposes stored data).
