@seydx/rtsp / RelayOptions
Interface: RelayOptions
Defined in: relay.ts:18
Options for relay creation.
Configures the single upstream source, its idle lifecycle, per-sink buffering, and startup behavior. Only source is required; the remaining fields tune how aggressively the relay holds the upstream open and how it copes with slow sinks.
Properties
autoStart?
optionalautoStart?:boolean
Defined in: relay.ts:55
Open the upstream eagerly during construction instead of on the first sink.
When true the relay calls Relay.start immediately so the source is connected before any sink is piped; otherwise the upstream stays idle until the first Relay.pipe. Defaults to false.
idleTimeout?
optionalidleTimeout?:number
Defined in: relay.ts:37
How long, in milliseconds, to keep the upstream alive after the last sink leaves before tearing it down.
When a positive value is given the relay waits that long before closing the source, letting a reconnecting client reuse the already-open upstream. A value of 0 (the default) stops the upstream immediately once the final sink detaches.
logger?
optionallogger?:Logger
Defined in: relay.ts:83
Optional logger for diagnostic and error output.
Receives non-fatal warnings and errors raised while pumping the upstream, initializing sinks, or closing the source. Propagated to sinks created via Relay.serveRtsp. When omitted no diagnostics are emitted.
maxQueue?
optionalmaxQueue?:number
Defined in: relay.ts:46
Per-sink buffer depth, in packets, before backpressure kicks in.
Each sink has its own queue; when a sink falls behind and its queue exceeds this depth, packets are dropped and the sink is re-synced at the next keyframe rather than blocking the whole fan-out. Defaults to 512.
source
source:
Source
Defined in: relay.ts:26
The single upstream that feeds every attached sink.
Exactly one connection to this source is held regardless of how many sinks are piped; the relay opens it lazily (or eagerly with autoStart) and fans each demuxed packet out to all ready consumers.
stallTimeout?
optionalstallTimeout?:number
Defined in: relay.ts:74
How long, in milliseconds, the running upstream may deliver no packet at all before it is treated as a silent stall and torn down.
A live source can wedge without ever ending: it delivers neither packets nor an end-of-stream nor an error — the classic symptom is a camera whose session "starts" but never sends a frame, or a network link that freezes mid-stream. The pump loop would otherwise wait on the next packet forever, leaving every consumer staring at a dead stream. With a positive value the relay watches the gap since the last dispatched packet; if it exceeds the timeout the pump is aborted, error is emitted, and the relay stops — so a consumer (or a reconnecting client) can restart it and force a fresh upstream session. Measured only while running, and reset by every packet, so a healthy stream never trips it. A value of 0 (the default) disables the watchdog and waits indefinitely. Set it above the largest legitimate gap the source can produce (several seconds for a low-frame-rate camera).