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
| Type | When |
|---|---|
beat_scheduled | Beat queued |
beat_firing | Beat executing |
beat_fired | Beat succeeded |
beat_failed | Beat failed |
beat_skipped | Beat skipped |
sensor_reading | Reading submitted |
adaptation_triggered | Rule fired |
bounds_blocked | Blocked by audience bounds |
scene_completed | Scene finished |
scene_aborted | Scene 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}/streamHeartbeats (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.