Skip to content

Lifecycle

destroy()

Shuts down the SDK and releases all connections.

js
await SDK.destroy();
  • Closes WebSocket and streaming connections
  • Resets status to IDLE
  • Clears message list and signal state
  • Detaches remote logger

WARNING

destroy() is an asynchronous function. You must use await.

Calling destroy() in an inactive state (IDLE) is ignored. Event callbacks are preserved after destroy(), so you don't need to re-register them on re-initialization.

Reconnection

If you need to reconnect, use destroy() followed by init().

js
await SDK.destroy();
await SDK.init(options);

Lifecycle Flow

State Transitions

SDKStatus

ValueDescription
IDLEInitial/reset state
CONNECTINGHTTP validation + WebSocket connecting
CONNECTING_FAILEDConnection failed (reverts to IDLE)
SOCKET_CONNECTEDWebSocket connection complete
SOCKET_FAILEDWebSocket connection failed (reverts to IDLE)
STREAMING_CONNECTEDVideo+audio track reception complete
STREAMING_FAILEDStreaming connection failed (reverts to IDLE)
CONNECTED_FINISHAll connections complete. Ready to use