Airwave

Live events (SSE)

Stream Airwave events in real time over a single connection, for a Tauri app or a live dashboard.

For an always-connected client, a Tauri desktop app or a wall-mounted dashboard, Airwave streams events over Server-Sent Events instead of pushing to a URL. You hold one long-lived connection and receive the same envelopes the webhooks deliver, the moment they happen.

Connect

GET /api/public/v1/events

Authenticate with an API key from Settings → API Keys, one of two ways depending on your client. The key is never accepted in the URL.

  • X-API-Key header — for a fetch-based client (a Tauri app, or anything reading the stream with fetch
    • a ReadableStream). Simplest, and it reconnects by just re-fetching.
  • A single-use ticket — for a browser EventSource, which can't set a header. First POST /api/public/v1/events/ticket with your X-API-Key header to get a short-lived, single-use ticket, then open the stream with ?ticket=. Your long-lived key stays in a header and never touches the URL.

Add ?types=session.started,session.ended to receive only certain events.

// browser / webview — mint a ticket (key stays in a header), then stream with ?ticket=
const base = "http://192.168.1.10:36020/api/public/v1/events";

async function connect() {
  const { ticket } = await fetch(`${base}/ticket`, {
    method: "POST",
    headers: { "X-API-Key": "airwave_your_key" },
  }).then((r) => r.json());

  const es = new EventSource(`${base}?ticket=${ticket}`);
  es.addEventListener("session.started", (e) => {
    const { data } = JSON.parse(e.data);
    console.log(`${data.user} started watching ${data.channel.name}`);
  });
  es.addEventListener("session.ended", (e) => {
    /* … */
  });
  // A ticket is single-use, so EventSource's built-in reconnect can't reuse it — on a drop, mint a fresh
  // ticket and open a new EventSource.
  es.onerror = () => {
    es.close();
    setTimeout(connect, 2000);
  };
}
connect();
# curl — watch the raw stream
curl -N -H "X-API-Key: airwave_your_key" \
  "http://192.168.1.10:36020/api/public/v1/events?types=session.started,session.ended"

The stream

Each message is an SSE frame whose event: is the event type and whose data: is the JSON envelope ({ id, type, timestamp, data }, the same shape and the same rich data a webhook carries: deviceId, channel, program, playbackState, delaySeconds, and progress). On connect you get a hello frame, and a keepalive frame arrives periodically so idle proxies don't drop the connection:

event: hello
data: {"product":"airwave","filter":"all"}

event: session.started
data: {"id":"evt_2a9f…","type":"session.started","timestamp":"2026-09-28T18:04:11.000Z","data":{"userId":"clx9user01","deviceId":"tauri-88ac21","user":"James","channel":{"id":"clx9ch01","number":101,"name":"90s Sitcoms","callsign":"SITCOM"},"program":{"ratingKey":"45210","title":"The One with the Blackout","showTitle":"Friends","season":1,"episode":7,"year":1994},"playbackState":"playing","delaySeconds":0,"progress":{"positionSeconds":0,"durationSeconds":1380}}}

event: keepalive
data: {"t":1790000666000}

The same event catalog applies: playback.* events stream for clients that report play/pause state, and channel.tuned streams for clients that keep a session across channel changes.

Because a ticket is single-use, a browser EventSource can't rely on its built-in auto-reconnect (the ticket is already spent). Handle onerror by closing the stream, minting a fresh ticket, and opening a new EventSource, as shown above. A fetch-based client reconnects by re-fetching with its header and a short backoff.

SSE or webhooks?

  • SSE suits a client that stays open and wants events live (a Tauri app, a dashboard). Nothing is stored; if the client is disconnected it simply misses events while away.
  • Webhooks suit a server-side integration (Home Assistant, n8n): Airwave POSTs to your URL with retries, so you don't need to hold a connection.

Both carry the same events and the same payloads.

On this page