Skip to content

@seydx/rtsp / RelayEvents

Interface: RelayEvents

Defined in: relay.ts:100

Event map emitted by a relay.

Describes the signatures of every event a Relay can emit, used to type the on/off/emit surface inherited from the typed emitter.

Properties

end

end: () => void

Defined in: relay.ts:124

Fired when the upstream ends on its own (EOF or disconnect).

Indicates the source stopped producing packets without a caller-initiated stop; the relay then drains and closes its sinks, after which stop follows.

Returns

void


error

error: (error) => void

Defined in: relay.ts:135

Fired when the relay encounters a non-recoverable error.

Carries the offending error. Raised when the upstream fails to open or the pump loop throws; the relay tears itself down afterwards. Emitting this event without a registered listener is safe — unlike a raw Node.js EventEmitter it does not throw, so consumers may opt out of error handling without risking a process crash.

Parameters

error

unknown

Returns

void


sink:added

sink:added: (sink) => void

Defined in: relay.ts:153

Fired immediately after a sink is piped onto the relay.

Carries the newly attached Sink. Emitted before the sink has been synced to a keyframe, so the sink may not yet be receiving packets.

Parameters

sink

Sink

Returns

void


sink:error

sink:error: (sink, error) => void

Defined in: relay.ts:145

Fired when an individual sink fails while being initialized or written to.

Carries the offending Sink and the error it raised. The relay isolates the failure — the sink's channel is closed (followed by sink:removed) while the upstream and all other sinks keep running — but surfaces it here so consumers can react instead of only seeing a log line.

Parameters

sink

Sink

error

unknown

Returns

void


sink:removed

sink:removed: (sink) => void

Defined in: relay.ts:161

Fired once a previously attached sink has been detached and closed.

Carries the removed Sink. May be triggered by Relay.unpipe, by the sink closing itself, or by relay teardown.

Parameters

sink

Sink

Returns

void


start

start: (info) => void

Defined in: relay.ts:108

Fired once the upstream is open and the stream layout is resolved.

Carries the StreamInfo describing the tracks (and optional backchannel) the relay will fan out. Emitted exactly once per running cycle, after attached sinks have been initialized.

Parameters

info

StreamInfo

Returns

void


stop

stop: () => void

Defined in: relay.ts:116

Fired after the upstream and every sink have been torn down.

Emitted on both explicit Relay.stop and end-of-stream teardown, signalling that the relay has returned to the idle state.

Returns

void