Skip to content

RelayPublisher

Defined in: relay-sdks/ts/src/publish.ts:196

A connection that can only publish, serving one namespace. Create one with connectRelayPublisher. Subscribing uses a separate connection; see connectRelaySubscriber.

readonly announced: Promise<void>;

Defined in: relay-sdks/ts/src/publish.ts:215

Settles once the namespace announce has reached the wire on a solicitation that covers it, which is no earlier than the first registered track. It is the strongest fact the publisher has: the relay acknowledges an announce with nothing and routes subscribes for the namespace about a round trip later, so a subscribe that races it is rejected (request error 16 unroutable on moq-relay 0.15.8 and later; see spec/behavior.md). It stays pending while no solicitation covers the namespace, where the first write reports NAMESPACE_NOT_SOLICITED, and the connection’s closure terminates it if that comes first: the closure’s error, or a CLOSED RelayError after a clean shutdown. Pre-handled, so nobody has to await it.


readonly closed: Promise<{
error?: unknown;
}>;

Defined in: relay-sdks/ts/src/publish.ts:217

Ends when the connection shuts down. Errors are returned as data; this never rejects.


readonly expiresAt: Date | undefined;

Defined in: relay-sdks/ts/src/publish.ts:226

When the relay will end this connection for its credential’s expiry: the RelayCredential’s expiresAt, or the JWT’s exp claim, read without verifying it. undefined when neither is known. The relay closes the session then with UNAUTHORIZED in phase connection; open a replacement before it. Supervised connections do.

close(): Promise<void>;

Defined in: relay-sdks/ts/src/publish.ts:232

End all tracks, retract the namespace, and wait for transport shutdown. First waits, for up to the largest writeTimeoutMs among the tracks, for completed groups the relay has not yet acknowledged; any still unacknowledged after that may be lost. Idempotent.

Promise<void>


registerTrack(options): RelayTrackWriter;

Defined in: relay-sdks/ts/src/publish.ts:204

Register a track this publisher will serve and return its writer. Nothing is sent: the relay learns of the track when a subscriber asks for it, and bytes move when the writer’s write() or openGroup() runs, after waiting for that relay demand. No capture starts and no media catalog is published. Track names are unique per publisher connection, including after their writer closes.

Parameter Type
options RegisterTrackOptions

RelayTrackWriter