Creates a new WebSocketClient instance.
The client instance.
Whether the WebSocket client is connected.
Optional
heartbeatThe interval for sending heartbeats, in milliseconds.
Optional
lastThe timestamp of the last ping sent, in milliseconds.
Optional
lastWhether the last pong acknowledgment was received.
Whether the WebSocket client is ready.
A promise representing the reconnecting process, or null
if not reconnecting.
Optional
socketThe WebSocket connection instance.
Gets the current ping (latency) of the WebSocket connection.
The ping in milliseconds, or -0
if the WebSocket is not connected.
Connects to the WebSocket server.
A promise that resolves when the connection is established.
Destroys the WebSocket connection and clears its state.
A promise that resolves when the connection is destroyed.
Sends data through the WebSocket connection.
The data to send.
A promise that resolves when the data is sent.
Sends a heartbeat to the server to keep the connection alive.
Sets the heartbeat interval for the WebSocket connection.
The interval time in milliseconds. Use -1
to clear the interval.
Represents the WebSocket client used for real-time communication with the API.