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. Using await is recommended where possible. In places where you cannot await (such as React cleanup callbacks), simply calling it is safe (it is serialized internally).

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
SOCKET_CONNECTEDWebSocket connection complete
STREAMING_CONNECTEDVideo+audio track reception complete
CONNECTED_FINISHAll connections complete. Ready to use

On connection failure the SDK reverts directly to IDLE; the cause is delivered as the rejection of init().