# Subscribe to live show changes

> Choose a live transport for runofsho room state, resume a stage display after a disconnect, or verify signed webhook deliveries on your server.

- Canonical: https://runofsho.com/developers/live-events/
- Last updated: 2026-11-22
- Publisher: runofsho

## Choose the transport

| Consumer | Transport | Why |
|---|---|---|
| A read-only stage display | Server-sent events (SSE) | One HTTP connection receives a snapshot followed by room changes. |
| A controller that subscribes and sends commands | Socket.IO | Two-way events and command acknowledgements on namespace `/v1`, path `/v1/socket.io`. See the [AsyncAPI contract](https://api.runofsho.com/asyncapi.json). |
| A backend that reacts to cue changes | Signed webhooks | The service delivers an HTTP POST to your HTTPS endpoint and retries unsuccessful deliveries. |

## Open a single-room stream

Use `API`, `ROOM` and a room-authorized read credential from the [quickstart](https://runofsho.com/developers/quickstart/). `-N` disables cURL buffering so each event appears as it arrives. Press Ctrl+C to disconnect.

```bash
curl -fsSN "$API/rooms/$ROOM/stream" \
  -H "Authorization: Bearer $RUNOFSHO_KEY" \
  -H 'Accept: text/event-stream'
```

On first connection, use `state.snapshot` to render the room. On a reconnect, send the last SSE `id` in `Last-Event-ID`. The single-room endpoint replays buffered changes when it can; accept a fresh snapshot when it cannot. If your client detects a gap, read the room state again. Do not treat the multi-room stream as having the same replay contract.

A countdown does not require an event every second. Render from the playback timestamps using a clock synchronized to `GET /v1/time`. For a public display, use a room-limited output credential, not a team API key. Native browser `EventSource` cannot set a bearer header; use an authenticated streaming client rather than moving the key into the URL.

## Receive and verify a webhook

Webhook setup requires a team `admin` credential and a plan that includes webhooks. Create a subscription with `POST /v1/webhooks`, store the returned signing secret immediately, then use the test-delivery endpoint before connecting the receiver to a real workflow.

1. Read the raw request body **before** parsing JSON. Read `Runofsho-Signature`, which contains `t` (Unix seconds) and `v1` (hex digest).
2. Verify freshness and signature: use a five-minute timestamp tolerance and compare HMAC-SHA256 of `t + "." + rawBody`, keyed with the webhook secret, using a constant-time comparison. Reject an invalid signature.
3. Deduplicate by delivery `id` and durably record or enqueue the work before acknowledging it. Return a 2xx within ten seconds; perform slow work asynchronously.
4. Compare room versions rather than assuming arrival order. If a delivery fails, inspect the delivery log before requesting a retry.

## Endpoint reference

- [Stream a room's events (SSE)](https://api.runofsho.com/docs/#tag/real-time/GET/v1/rooms/{roomId}/stream): `GET /v1/rooms/{roomId}/stream` (`streamRoom`).
- [Stream several rooms (SSE)](https://api.runofsho.com/docs/#tag/real-time/GET/v1/stream): `GET /v1/stream` (`streamRooms`).
- [Create a webhook](https://api.runofsho.com/docs/#tag/webhooks/POST/v1/webhooks): `POST /v1/webhooks` (`createWebhook`).
- [Send a test event](https://api.runofsho.com/docs/#tag/webhooks/POST/v1/webhooks/{webhookId}/test): `POST /v1/webhooks/{webhookId}/test` (`testWebhook`).
- [List a webhook's deliveries, newest first](https://api.runofsho.com/docs/#tag/webhooks/GET/v1/webhooks/{webhookId}/deliveries): `GET /v1/webhooks/{webhookId}/deliveries` (`listWebhookDeliveries`).
- [Send a delivery again](https://api.runofsho.com/docs/#tag/webhooks/POST/v1/webhooks/{webhookId}/deliveries/{deliveryId}/retry): `POST /v1/webhooks/{webhookId}/deliveries/{deliveryId}/retry` (`retryWebhookDelivery`).
