Schedules
Create timed runs, control event access and inspect scheduler outcomes.
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.
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, schedule mutations streams:write, ingest issuance streams:publish and viewer grants streams:playback. CreateScheduleInput contains broadcast and timing. ScheduleTiming uses UTC startsAt/endsAt, an IANA timeZone, source/catch-up windows, publisher/viewer windows and nullable notifyBeforeSeconds.
Methods
All methods return promises. Their final argument is optional RequestOptions. Input and result names are public imports from @relayrtc/node.
| Method | Signature |
|---|---|
schedules.create | (input: CreateScheduleInput, options?: RequestOptions): Promise<ScheduledBroadcast> |
schedules.list | (query?: { cursor?: string; limit?: number; state?: ScheduleState; }, options?: RequestOptions): Promise<SchedulePage> |
schedules.get | (scheduleId: string, options?: RequestOptions): Promise<ScheduledBroadcast> |
schedules.update | (scheduleId: string, input: UpdateScheduleInput, options?: RequestOptions): Promise<ScheduledBroadcast> |
schedules.cancel | (scheduleId: string, input: { version: number; }, options?: RequestOptions): Promise<ScheduledBroadcast> |
schedules.startNow | (scheduleId: string, input: { version: number; }, options?: RequestOptions): Promise<ScheduledBroadcast> |
schedules.getOperation | (operationId: string, options?: RequestOptions): Promise<ScheduleOperation> |
schedules.getPlayback | (scheduleId: string, options?: RequestOptions): Promise<ScheduledPlayback> |
schedules.createPlaybackGrant | (scheduleId: string, input?: { ttlSeconds?: number; }, options?: RequestOptions): Promise<PlaybackGrant> |
schedules.createIngestCredentials | (scheduleId: string, options?: RequestOptions): Promise<IngestCredential & { scheduleId: string; notBefore: string; }> |
Behavior and results
Update, cancel and startNow require the current version. A schedule snapshots its run configuration and rechecks creator authority at execution. Changes revoke earlier event credentials. Playback metadata contains serverTime/countdownSeconds; event grants cannot outlast the event end. viewerAfterSeconds extends ended metadata, not live media. resolveScheduleLocalTime converts local wall times with explicit DST handling.
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.
Convert local time
import { resolveScheduleLocalTime } from '@relayrtc/node'
export function toUtc(localDateTime: string, timeZone: string) {
return resolveScheduleLocalTime(localDateTime, timeZone)
}