Realtime Client
The Realtime Client is the main entry point for the Realtime SDK. It provides methods to connect to the SignalWire Realtime service, authenticate, and access namespace clients for voice, video, chat, task, and pubsub functionality.
How It Works
The SDK operates through a bidirectional WebSocket connection. When you call methods like dialPhone() or send(), the SDK sends requests to SignalWire and returns promises with the results. Simultaneously, you can listen for real-time events like incoming calls or messages using the listen() method on each namespace client.
Use connect to re-establish a connection after disconnecting, or disconnect to close the connection.
Constructor
▸ SignalWire(options): Promise<SWClient>
Creates a new Realtime Client instance.
Parameters
Configuration options for the client.
SignalWire project id, e.g. a10d8a9f-2166-4e82-56ff-118bc3a4840f
SignalWire project token, e.g. PT9e5660c101cd140a1c93a0197640a369cf5f16975a0079c9
SignalWire host URL. Default is the standard SignalWire host.
Log level: 'trace', 'debug', 'info', 'warn', 'error', or 'silent'.
Debug configuration object.
If true, logs all WebSocket traffic.
Namespace Clients
The Realtime Client provides access to namespace clients for different communication features. Access them via properties on the client instance.
Available Namespace Clients
Make and receive phone calls, play audio, gather input, and build IVR systems.
Monitor video rooms, track participants, and manage recordings.
Real-time chat messaging between users across channels.
Distribute tasks to workers for server-side processing.
Publish and subscribe to messages across channels.