WebSocketOptions
interface
interface WebSocketOptionsOptions for a WebSocket instance. This feature is non-standard.
Properties
protocols
protocols?: string | string[]The sub-protocol(s) that the client would like to use, in order of preference.
headers
headers?: HeadersInitA Headers object, an object literal, or an array of two-item arrays to set handshake's headers. This feature is non-standard.
client
client?: Ende.HttpClientexperimental
An HttpClient instance to use when creating the WebSocket connection.
This is useful when you need to connect through a proxy or customize TLS settings.
const client = Ende.createHttpClient({
proxy: {
transport: "unix",
path: "/path/to/socket",
},
});
const ws = new WebSocket("ws://localhost:8000/socket", { client });