Defjs
Core

withWebSocketHandle

Replaces the WebSocket constructor used for socket connections.

@defjs/core · Function

Signature

function withWebSocketHandle(
  WebSocketImpl: WebSocketHandleConstructor,
): ClientOption;

The default is globalThis.WebSocket. WebSocketImpl is a WebSocketHandleConstructor that returns a WebSocketHandle. If no constructor is available, a WebSocket operation fails with an ENV_UNSUPPORTED fault.

Parameters

Prop

Type

WebSocketImpl WebSocketHandleConstructor

Constructor that returns a WebSocketHandle.

Returns

An option that sets config.webSocket.handle.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao