Skip to main content
Version: v10.0.0

getWebsocketConstructor

The WebSocket constructor to use: the one from adapterOptions , otherwise the global one (browsers, Node.js 22+, Bun, Deno). null when the runtime has none.


Import
import { getWebsocketConstructor } from "@hyper-fetch/sockets"

Parameters​

getWebsocketConstructor(adapterOptions: EmptyTypes | WebsocketAdapterOptionsType)
Parameters
NameTypeDescription
adapterOptions
EmptyTypes | WebsocketAdapterOptionsType

Returns​

null | (url: string | URL, protocols?: string | string[]) => WebSocket