Skip to content

SupervisedSubscriber

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:180

A subscriber that reconnects and keeps wanted tracks subscribed. Create one with connectSupervisedSubscriber.

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

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:202

Resolves once the supervisor stops: close(), the signal, or a failure it does not retry. Never rejects.


readonly status: SupervisedStatus;

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:200

Where the supervisor stands; see SupervisedStatus.

catchUp(key): void;

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:198

Replace a want’s accepted subscription at once, break-before-make, because it delivers too late to use: cancel it, which makes the relay drop what it still holds queued for it, and subscribe again with the same options, so a want without a location filter starts at the newest group. onRestarted reports 'catch-up'. A frame reader’s onCatchUp is the usual caller. The new subscription opens without delay when the old one had moved past its first group, and otherwise after the want’s retry backoff, so a link too slow for the track cannot make it spin. Ignored for an unknown key and while no subscription is accepted.

Parameter Type
key string

void


close(): void;

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:215

Stop reconnecting, cancel every want and close the connection. Idempotent.

void


rotate(): void;

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:213

Replace the connection make-before-break, as happens on its own rotateBeforeMs before the credential expires: a new connection opens, with a fresh token, and every want moves its subscription to it as a move would, keeping the old one delivering until the cutover. A want whose target is unchanged cuts over on the first object the old one did not deliver, with no callback: nothing is lost or repeated. The old connection closes once every want has moved, after 10 seconds at most. A no-op while no connection is up.

void


unwant(key): void;

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:189

Cancel a want’s subscription and forget it. Unknown keys are ignored.

Parameter Type
key string

void


want(
key,
options,
handlers?
): void;

Defined in: relay-sdks/ts/src/supervised-subscriber.ts:187

Keep a subscription to a track open until unwant(key). Wanting a key again with the same namespace and generations updates the want in place: the handlers, retry, staleAfterMs, until and drainMs are swapped, and another track or parameters moves the subscription make-before-break. Another namespace or generations replaces the want. Arguments are checked at once.

Parameter Type
key string
options WantOptions
handlers? WantHandlers

void