RODEO

Streaming

Real-time scene events via Server-Sent Events.

Rodeo streams scene events in real-time via SSE. The SDK provides an async iterator; the API exposes a raw endpoint.

SDK

for await (const event of rodeo.scenes.stream(sceneId)) {
  switch (event.type) {
    case "beat_fired":
    case "sensor_reading":
    case "adaptation_triggered":
    case "scene_completed":
      console.log(event.type, event.data);
  }
}

Events

TypeWhen
beat_scheduledBeat queued
beat_firingBeat executing
beat_firedBeat succeeded
beat_failedBeat failed
beat_skippedBeat skipped
sensor_readingReading submitted
adaptation_triggeredRule fired
bounds_blockedBlocked by audience bounds
scene_completedScene finished
scene_abortedScene manually aborted

Shape

interface SceneEvent {
  type: string;
  beat_id?: string;
  data?: Record<string, unknown>;
  timestamp?: string;
}

Raw SSE

curl -N -H "Authorization: Bearer your-api-key" \
  http://localhost:3000/scenes/{sceneId}/stream

Heartbeats (empty data: lines) sent every 15 seconds.

Browser

const es = new EventSource("/api/proxy/scenes/{sceneId}/stream");
es.onmessage = (e) => {
  if (!e.data) return;
  const event = JSON.parse(e.data);
  console.log(event.type, event.data);
};

EventSource reconnects automatically on connection loss.

Lifecycle

The stream stays open while the scene is live or adapting. On completion, abort, or expiry, the server sends a final event and closes.