Skip to content

RelaySubscriber

Defined in: relay-sdks/ts/src/connect.ts:123

A connection that can only subscribe. Create one with connectRelaySubscriber. Publishing uses a separate connection and token; see connectRelayPublisher.

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

Defined in: relay-sdks/ts/src/connect.ts:159

Resolves once for local shutdown, peer closure, or failure. It never rejects.


readonly expiresAt: Date | undefined;

Defined in: relay-sdks/ts/src/connect.ts:168

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.


readonly maxAgeSupported: boolean;

Defined in: relay-sdks/ts/src/connect.ts:175

Whether the relay’s SETUP declared subscriber max age (the MoQ Timestamp extension’s MAX_AGE option, 0x915C4), so a parameters.maxAge on subscribe, subscribeSwitchable, subscribeEvents, update() or trackSource.subscribe reaches it. While false the SDK leaves maxAge off every request, as the extension requires. moq-dev main declares it; moq-relay 0.17.x does not. Fixed for the connection’s life.


readonly trackSource: MoqTrackSource;

Defined in: relay-sdks/ts/src/connect.ts:157

This connection seen through the generic MoqTrackSource contract, for integrations such as players: subscribe, fetch, and trackStatus in protocol terms, plus closed. It lists no tracks and cannot close the connection; the application that opened the connection owns shutdown.

close(): void;

Defined in: relay-sdks/ts/src/connect.ts:177

Close this connection and all requests on it. Idempotent.

void


namespaceEvents(options): NamespaceEvents;

Defined in: relay-sdks/ts/src/connect.ts:150

Discover which namespaces under a prefix are announced, as bounded async events with the same ownership rules as subscribeEvents: the iterator owns one SUBSCRIBE_NAMESPACE request, and break/return, close() or the signal cancels it. It first yields announced for each namespace already announced, then one event per announce and withdrawal. The relay sends no marker between the two. A relay rejection ends it with SubscriptionRequestError, the connection ending with SubscriptionConnectionClosedError, a full queue with SubscriptionOverflowError; a relay that finishes the request ends it cleanly. See spec/behavior.md, “Discovery”, for the timing.

Parameter Type
options NamespaceEventOptions

NamespaceEvents


subscribe(options, handlers?): RelaySubscription;

Defined in: relay-sdks/ts/src/connect.ts:130

Ask the relay for a track’s objects, in any payload format, without discovering or loading a catalog. Returns at once with a cancellable handle whose subscribed settles when the relay answers and whose ended settles once the subscription can no longer deliver; handlers.onSubscribed and handlers.onError report the same answer as callbacks.

Parameter Type
options RelayTrackOptions
handlers? RelaySubscriptionHandlers

RelaySubscription


subscribeEvents(options, buffer?): SubscriptionEvents;

Defined in: relay-sdks/ts/src/connect.ts:140

Bounded async events. Owns its subscription; break/return cancels it.

Parameter Type
options RelayTrackOptions
buffer? SubscriptionEventOptions

SubscriptionEvents


subscribeSwitchable(options, handlers?): SwitchableSubscription;

Defined in: relay-sdks/ts/src/connect.ts:138

Subscribe to a track through a handle that can move to another track in the same namespace make-before-break: switchTo opens the new subscription while this one keeps delivering, and cuts over once the new one’s object passes until. Use it to change layers (simulcast, ABR), or to change a subscription’s filter or priority, which update() cannot do against moq-relay. Handlers see only the active subscription, with its track name.

Parameter Type
options RelayTrackOptions
handlers? SwitchableHandlers

SwitchableSubscription