RelayrtcDocs
Get started
Documentation
Node SDK

Broadcasts

Control individual runs and inspect independently managed outputs.

On this page

These methods run on your backend and require a compatible API/SDK build; see installation.

Import and client

Set RELAYRTC_API_URL and RELAYRTC_SECRET_KEY in your backend environment. Keep the secret key on the server.

TypeScript
import { RelayServer } from '@relayrtc/node'
 
const relay = new RelayServer({
  apiUrl: process.env.RELAYRTC_API_URL!,
  apiKey: process.env.RELAYRTC_SECRET_KEY!,
})

Authorization and inputs

Reads require streams:read; run commands require streams:write. Create snapshots the source, profile, destinations and automatic recording policy. A run includes exactly one HLS output. Start can wait for a source; terminal runs cannot restart. Stop preserves the source session and room. Output retry affects only the selected failed output.

Methods

All methods return promises. Their final argument is optional RequestOptions. Input and result names are public imports from @relayrtc/node.

MethodSignature
broadcasts.outputs.retry(broadcastId: string, outputId: string, input?: BroadcastCommandInput, options?: RequestOptions): Promise<StreamingOperation>
broadcasts.create(input: CreateBroadcastInput, options?: RequestOptions): Promise<BroadcastResource>
broadcasts.list(query?: ListBroadcastsQuery, options?: RequestOptions): Promise<BroadcastPage>
broadcasts.get(broadcastId: string, options?: RequestOptions): Promise<BroadcastDetail>
broadcasts.start(broadcastId: string, input?: BroadcastCommandInput, options?: RequestOptions): Promise<StreamingOperation>
broadcasts.stop(broadcastId: string, input?: BroadcastCommandInput, options?: RequestOptions): Promise<StreamingOperation>
broadcasts.getOutputs(broadcastId: string, options?: RequestOptions): Promise<{ data: BroadcastOutput[]; }>

Behavior and results

BroadcastPage uses data and nextCursor. ListBroadcastsQuery accepts streamId, state, cursor, limit (1–100; default 30), order (id or newest) and activeOnly (boolean). StreamingOperation represents asynchronous start/stop/retry; poll streamingOperations.get before treating work as complete.

Requests and errors

Streaming commands generate an idempotency key when omitted. Use an explicit stable key when retrying an uncertain application command; reuse its payload and target. Mutations do not retry automatically. Read retries and cancellation follow RequestOptions. A canceled HTTP request does not undo committed server work.

Failures throw RelayApiError. Reload resources after version conflicts; inspect asynchronous operation/processing states before reporting completion.

See REST parameters, defaults and errors and the public type index.