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
| Value | Description |
|---|---|
IDLE | Initial/reset state |
CONNECTING | HTTP validation + WebSocket connecting |
SOCKET_CONNECTED | WebSocket connection complete |
STREAMING_CONNECTED | Video+audio track reception complete |
CONNECTED_FINISH | All connections complete. Ready to use |
On connection failure the SDK reverts directly to IDLE; the cause is delivered as the rejection of init().