Skip to content

ConnectRelaySubscriberOptions

Defined in: relay-sdks/ts/src/connect-session.ts:97

Options for connectRelaySubscriber: the shared connection options plus the request deadline.

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.

ConnectRelayOptions.connectTimeoutMs


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.

ConnectRelayOptions.createTransport


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.

| string | RelayCredential | Promise< | string | RelayCredential | undefined> | undefined

ConnectRelayOptions.getToken


requestTimeoutMs?: number;

Defined in: relay-sdks/ts/src/connect-session.ts:99

Deadline for an initial subscription response, not for silence on an accepted track. Default 10 seconds, maximum 2147483647.


signal?: AbortSignal;

Defined in: relay-sdks/ts/src/connect-session.ts:85

Aborting closes the connection, including after the connect call has resolved.

ConnectRelayOptions.signal


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.

ConnectRelayOptions.url