WebSocketOptions Object
May 20, 2026 ยท View on GitHub
protocolsstring | string[] (optional) - Requested WebSocket subprotocols.headersRecord<string, string> (optional) - Extra HTTP headers to send with the opening handshake.originstring (optional) - Value of theOriginheader to send with the opening handshake. Defaults to thehttp(s)equivalent of the WebSocket URL's origin (e.g. connecting towss://api.example.comsendsOrigin: https://api.example.com), so that the connection is treated as same-origin by the server and by SameSite cookie rules.useSessionCookiesboolean (optional) - Whether to send cookies from the session with the opening handshake and store cookies received in the handshake response. Default isfalse.sessionSession (optional) - TheSessionthe connection is associated with.partitionstring (optional) - The name of thepartitionthe connection is associated with. Defaults to the empty string, which corresponds to the default session. Ifsessionis provided,partitionis ignored.