SupervisedSubscriber
Defined in: relay-sdks/ts/src/supervised-subscriber.ts:180
A subscriber that reconnects and keeps wanted tracks subscribed. Create one with connectSupervisedSubscriber.
Properties
Section titled “Properties”closed
Section titled “closed”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.
status
Section titled “status”readonly status: SupervisedStatus;Defined in: relay-sdks/ts/src/supervised-subscriber.ts:200
Where the supervisor stands; see SupervisedStatus.
Methods
Section titled “Methods”catchUp()
Section titled “catchUp()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
Returns
Section titled “Returns”void
close()
Section titled “close()”close(): void;Defined in: relay-sdks/ts/src/supervised-subscriber.ts:215
Stop reconnecting, cancel every want and close the connection. Idempotent.
Returns
Section titled “Returns”void
rotate()
Section titled “rotate()”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.
Returns
Section titled “Returns”void
unwant()
Section titled “unwant()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
Returns
Section titled “Returns”void
want()
Section titled “want()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
options |
WantOptions |
handlers? |
WantHandlers |
Returns
Section titled “Returns”void