withWebSocketFallback
function withWebSocketFallback(options?): FallbackTransportFactory;Defined in: relay-sdks/ts/packages/relay-websocket/src/index.ts:101
A transport factory for the SDK’s createTransport option that dials the runtime’s WebTransport first and, unless
that handshake completes within webSocketDelayMs (default 250 ms, as Happy Eyeballs, RFC 8305), dials QMux over
WebSocket alongside it. The first ready carries the session and the other dial is closed; a WebTransport handshake
that fails sooner starts the WebSocket at once. Where the runtime has no usable WebTransport (Safari before
WebTransport, Node), it dials WebSocket at once. Each connection decides afresh.
import { connectRelayPublisher } from '@caprid/relay';import { withWebSocketFallback } from '@caprid/relay-websocket';
const publisher = await connectRelayPublisher({ url, getToken, createTransport: withWebSocketFallback() });Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
WebSocketFallbackOptions |