TelnyxRTC
TheTelnyxRTC class is the main entry point for the Telnyx WebRTC JS SDK. It manages the WebSocket connection to Telnyx’s signaling server and provides methods to create calls, handle events, and control the client lifecycle.
Constructor
connect() to establish the WebSocket connection.
Parameters:
Example:
Methods
connect()
Opens a WebSocket connection to rtc.telnyx.com and authenticates using the configured credentials.
telnyx.ready on success or telnyx.error on failure.
disconnect()
Closes the WebSocket connection and cleans up all active calls.
Always call
disconnect() when the user leaves your app to avoid zombie WebSocket connections. See Best Practices → Connection Lifecycle.newCall(options)
Creates and places a new outbound call.
Returns: Call
See ICallOptions for all available options including custom headers, ICE configuration, and media settings.
off(event, handler)
Removes an event listener.
removeAllListeners()
Removes all event listeners from the client.
Properties
connection
Provides helpers to check the current connection state.
calls
An array of all active Call objects.
Events
Register event listeners usingclient.on(eventName, handler):
Connection Events
Call Events
Stats Events
Typical Usage
Reconnection
The SDK automatically reconnects when the WebSocket drops. You don’t need to handle this manually in most cases. For advanced reconnection handling, see Reconnection & Recovery. Key configuration:See Also
- IClientOptions — Full configuration reference
- Call Class — Call control methods
- Error Handling — Error and warning codes
- Best Practices — Production deployment guide
- Authentication — JWT generation and token refresh