ConnectSupervisedPublisherOptions
Defined in: relay-sdks/ts/src/supervised-publisher.ts:39
Options for connectSupervisedPublisher: the shared connection options, the root namespace and the policy.
Extends
Section titled “Extends”Properties
Section titled “Properties”connectTimeoutMs?
Section titled “connectTimeoutMs?”connectTimeoutMs?: number;Defined in: relay-sdks/ts/src/connect-session.ts:87
Deadline for token resolution, transport connection, and protocol SETUP. Default 10 seconds, maximum 2147483647.
Inherited from
Section titled “Inherited from”ConnectRelayOptions.connectTimeoutMs
createTransport?
Section titled “createTransport?”createTransport?: RelayTransportFactory;Defined in: relay-sdks/ts/src/connect-session.ts:93
Create the transport. Defaults to the browser’s WebTransport; a runtime without it, or whose
WebTransport cannot negotiate protocols, fails with TRANSPORT_UNAVAILABLE unless this is
supplied.
Inherited from
Section titled “Inherited from”ConnectRelayOptions.createTransport
getToken?
Section titled “getToken?”getToken?: () => | string | RelayCredential | Promise< | string | RelayCredential | undefined> | undefined;Defined in: relay-sdks/ts/src/connect-session.ts:83
Resolve a connection token. Relay carries it in the endpoint’s jwt query parameter.
An explicit jwt in the URL wins, and the provider is not called in that case. An empty jwt
in the URL is a RangeError, raised before the provider or the transport is used. Return a
RelayCredential to say when the token expires; for a bare token the connection reads
the JWT’s exp claim, without verifying it. The provider runs once per connection: a live
session keeps the token it connected with until the relay ends it at that expiry.
Returns
Section titled “Returns”| string
| RelayCredential
| Promise<
| string
| RelayCredential
| undefined>
| undefined
Inherited from
Section titled “Inherited from”namespace
Section titled “namespace”namespace: readonly string[];Defined in: relay-sdks/ts/src/supervised-publisher.ts:44
The root namespace. Each connection serves the root followed by one generation field the SDK chooses, so the token must grant the root, not just one namespace under it.
reconnect?
Section titled “reconnect?”reconnect?: SupervisionBackoff;Defined in: relay-sdks/ts/src/supervised-publisher.ts:46
Backoff between connection attempts. Default from 500 ms, doubling up to 10 s, with jitter.
rotateBeforeMs?
Section titled “rotateBeforeMs?”rotateBeforeMs?: number;Defined in: relay-sdks/ts/src/supervised-publisher.ts:51
How long before the connection’s credential expires (RelayPublisher.expiresAt) the next generation is brought
up to replace it, make-before-break. Default 60 seconds; never earlier than halfway through the time left.
signal?
Section titled “signal?”signal?: AbortSignal;Defined in: relay-sdks/ts/src/connect-session.ts:85
Aborting closes the connection, including after the connect call has resolved.
Inherited from
Section titled “Inherited from”url?: string;Defined in: relay-sdks/ts/src/connect-session.ts:74
Relay’s HTTPS WebTransport endpoint, including any endpoint path. Left out, the connection dials
DEFAULT_ENDPOINT rooted at the token’s root claim, read without verifying the token: the URL roomEndpoint
builds from that root. getToken is then required, and a token that names no usable root is a TypeError or
RangeError before the transport is used. Pass url for another relay, region or room.
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”onGeneration()?
Section titled “onGeneration()?”onGeneration?(info): void;Defined in: relay-sdks/ts/src/supervised-publisher.ts:57
Called once each generation’s connection is up and every registered track is bound to it. On a rotation, once
the next generation is up and every track is registered on it; each track moves to it as described in rotate(). A throw stops the
supervisor with that error, as onStatus does.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
info |
PublisherGeneration |
Returns
Section titled “Returns”void
onStatus()?
Section titled “onStatus()?”onStatus?(status, error?): void;Defined in: relay-sdks/ts/src/supervised-publisher.ts:63
Called on every status change; error is what ended the previous connection or failed the last attempt. A throw
stops the supervisor with that error: a pending connectSupervisedPublisher rejects with it and closed resolves
with it. A throw reporting closed rejects the close() that caused it; closed resolves either way.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
status |
SupervisedStatus |
error? |
unknown |
Returns
Section titled “Returns”void