Skip to content

Function: safeTerminateWs() ​

ts
function safeTerminateWs(ws?: unknown, fallbackToClose?: boolean): boolean;

Call terminate() when supported by the WebSocket implementation. Otherwise, call close() only when fallbackToClose is true. Returns true for termination and false for fallback or a missing socket.

Parameters ​

ParameterType
ws?unknown
fallbackToClose?boolean

Returns ​

boolean

Built by Siebly. Open source SDKs for exchange APIs.