SupervisedPublisher
Defined in: relay-sdks/ts/src/supervised-publisher.ts:78
A publisher that reconnects. Create one with connectSupervisedPublisher. Each connection is a new generation with its own namespace; tracks are registered once and rebound to every generation.
Properties
Section titled “Properties”closed
Section titled “closed”readonly closed: Promise<{ error?: unknown;}>;Defined in: relay-sdks/ts/src/supervised-publisher.ts:92
Resolves once the supervisor stops: close(), the signal, or a failure it does not retry. Never rejects.
generation
Section titled “generation”readonly generation: | PublisherGeneration | undefined;Defined in: relay-sdks/ts/src/supervised-publisher.ts:80
The live generation, or undefined between connections and after closing.
status
Section titled “status”readonly status: SupervisedStatus;Defined in: relay-sdks/ts/src/supervised-publisher.ts:82
Where the supervisor stands; see SupervisedStatus.
Methods
Section titled “Methods”close()
Section titled “close()”close(): Promise<void>;Defined in: relay-sdks/ts/src/supervised-publisher.ts:104
Stop reconnecting and close the live generation as RelayPublisher.close() does. Idempotent.
Returns
Section titled “Returns”Promise<void>
registerTrack()
Section titled “registerTrack()”registerTrack(options): RelayTrackWriter;Defined in: relay-sdks/ts/src/supervised-publisher.ts:90
Register a track every generation serves, and return the writer that outlives the generations. The same rules as
RelayPublisher.registerTrack, checked at once: track names are unique per supervised publisher, including after
their writer closes. Writes wait for demand on the live generation; while none is up they fail with
RECONNECTING, and an operation the connection’s end interrupts fails with RECONNECTING too, never CLOSED, so
a frame writer treats it as an interruption and resumes at the next keyframe.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
RegisterTrackOptions |
Returns
Section titled “Returns”rotate()
Section titled “rotate()”rotate(): void;Defined in: relay-sdks/ts/src/supervised-publisher.ts:102
Replace the live generation make-before-break, as happens on its own rotateBeforeMs before the credential
expires: the next generation connects, with a fresh token, and every track is registered on it. Each track’s
writer then moves to it at its next write or group, once the track has demand there or has none on the old one.
The old generation closes once every track has moved, after 10 seconds at most. A no-op while no generation is up.
Returns
Section titled “Returns”void