Skip to main content
Version: v10.0.0

OrpcWebsocketAdapterOptionsType

Options of the OrpcWebsocketAdapter , set with the adapterOptions of the socket or per connection in onConnect


Import
import { OrpcWebsocketAdapterOptionsType } from "@hyper-fetch/orpc"

Preview​

type OrpcWebsocketAdapterOptionsType = {
WebSocket?: typeof WebSocket;
autoConnect?: boolean;
headers?: Record<string, string>;
protocols?: string | string[];
}

Structure​

OrpcWebsocketAdapterOptionsType
NameTypeDescription
WebSocket
typeof WebSocket

The WebSocket constructor, e.g. from the ws package. Defaults to the global WebSocket of browsers, Node.js 22+, Bun and Deno. Pass it in runtimes without the global.

autoConnect
boolean

Connects when the socket is created. Without it, call socket.connect() .

headers
Record<string, string>

Headers of every subscription request, the procedures read them the same as the headers of HTTP requests

protocols
string | string[]

Subprotocols passed to the WebSocket constructor ( Sec-WebSocket-Protocol header)