Skip to content

Interface: WebSocketLike ​

The portable portion of a WebSocket connection exposed by this SDK.

Node.js ws instances and browser-native WebSocket instances both satisfy this interface. Runtime-specific extensions remain available through wsOptions, without making consumers install Node.js or ws declarations.

Properties ​

PropertyModifierTypeDescription
binaryType?publicstring-
on?public(event: string, listener: (event: unknown) => void) => unknownNode.js-style event API. Undefined for browser-native sockets.
onclosepublic((event: any) => any) | null-
onerrorpublic((event: any) => any) | null-
onmessagepublic((event: any) => any) | null-
onopenpublic((event: any) => any) | null-
ping?public() => voidNode.js ws extension. Undefined for browser-native sockets.
readyStatereadonlynumber-
terminate?public() => voidNode.js ws extension. Undefined for browser-native sockets.
wsKey?publicstringInternal connection identifier attached by the SDK.

Methods ​

close() ​

ts
close(code?: number, reason?: string): void;

Parameters ​

ParameterType
code?number
reason?string

Returns ​

void


send() ​

ts
send(data: any): void;

Runtime implementations accept their own wider binary-data variants.

Parameters ​

ParameterType
dataany

Returns ​

void

Built by Siebly. Open source SDKs for exchange APIs.