Web
The Voximplant Web SDK enables real-time voice and video communication, peer-to-peer calling, and multi-party conferencing in modern JavaScript and TypeScript applications. It integrates seamlessly with popular frontend frameworks such as React, Vue, and Angular, as well as standard vanilla JavaScript setups.
For all new integrations, use Web SDK v5. Designed for modern web development, Web SDK v5 is distributed as an NPM package and offers native TypeScript support, a modular architecture, and a streamlined integration workflow.
API reference and migration
- Web SDK v5 API reference
- Web SDK v5 migration guide — for upgrading from Web SDK v4
- @voximplant/websdk on NPM
- Web SDK v5 demo repository
Important requirements
- Web SDK v5 should run in a secure context (HTTPS) or potentially trustworthy origins to access media devices and stream audio and video.
- Browser compatibility: Web SDK v5 is supported on all modern desktop and mobile browsers with WebRTC enabled, including Chrome, Safari, Firefox, and Edge.
Add Voximplant libraries to your project
Web SDK v5 is distributed as an NPM package. Add the @voximplant/websdk package to your project using your preferred package manager:
or
Pin an exact SDK version in your package.json file. For available versions, refer to the Web SDK v5 changelog.
Specifying an exact version across development and production environments helps prevent unexpected breaking changes when new major or minor versions are released.
Initialize the SDK
Web SDK v5 uses a modular architecture built around an IoC container. To get started, initialize the Core instance via Core.init.
The Client module is built in and accessible directly via the core.client property. To extend the functionality, e.g., add voice and video calls or media stream management, register optional module loaders via Core.registerModules.
To reduce your initial bundle size, you can load Voximplant modules asynchronously on demand. Modern bundlers like Webpack or Vite will automatically split these dynamic imports into separate chunks.
Connect and log in
To access Voximplant communication features, your application should establish a connection to the Voximplant Cloud and authenticate a user.
The Client interface provides the API methods for connection and user authentication:
- Client.connect() — Establishes a connection to the Voximplant Cloud using your account’s assigned node.
- Client.login() — Authenticates user credentials with the platform.
When initializing and connecting the SDK to the Voximplant Cloud, you need to specify the node to connect to. Your node is bound to your Voximplant account. To find which node your account belongs to, log in to your control panel and see the Credentials for working with API, SDK, SIP section on the main dashboard.
Failed Client.connect() and Client.login() calls reject their promises with typed error objects derived from base error classes: ConnectionError and LoginError.
You can use standard try...catch blocks and instanceof checks to handle connection and authentication failures globally:
Connection events and state tracking
While try...catch blocks handle immediate connection failures, monitoring the ongoing connection lifecycle, such as network drops or state changes, requires listening to Client events and watching the Client.state property.
Key mechanisms:
- ClientEvent.Disconnected — Triggered whenever the connection to the Voximplant Cloud closes. The event payload contains a ClientDisconnectReason:
- ConnectionLost — Disconnected unexpectedly due to network issues.
- UserInitiated — Disconnected intentionally via a Client.disconnect() call.
- Client.state — A read-only watchable that reflects the current ClientState:
Connecting,Connected,LoggingIn,LoggedIn,Disconnecting,Disconnected, orReconnecting.
Subscribe to events with Client.addEventListener() and to state changes with the Watchable.watch() API:
Web SDK demos
To accelerate your integration, explore the reference applications available in the Web SDK v5 demo repository:
- Audio Call Demo — A complete audio calling application built with Vue.js 3 and TypeScript. It demonstrates user authentication, audio calls to Voximplant users, SIP addresses, and phone numbers, audio device management, call controls, DTMF tone sending, and incoming call handling.
- Push Service Demo — Extends the Audio Call Demo with Firebase Cloud Messaging (FCM) push notifications. It shows how to register push tokens via the
PushServicemodule, configure service workers, and support Progressive Web App (PWA) features.
Each demo is self-contained. To run a demo locally, navigate to its directory and run:
Refer to each example’s README.md file for detailed configuration and setup instructions.
Web SDK v4 (Legacy)
Use Web SDK v4 only when maintaining an existing application. For all new integrations, use Web SDK v5.
Web SDK v4 will be supported until December 31, 2027. Support for Web SDK v4 is limited to critical bug fixes; all new features and platform enhancements are added exclusively to Web SDK v5.
Web SDK v4 is distributed via a CDN or the legacy voximplant-websdk NPM package and operates using the global VoxImplant namespace. For detailed documentation on the legacy API, see the Web SDK v4 API reference.
CDN
Include the following script tag in your HTML file to load the legacy SDK:
Replace VERSION with an exact version from the Web SDK v4 changelog.
We recommend specifying the exact SDK version when building both development and production applications. If you omit the version or use the @latest keyword, your application will always load the latest version, which may cause breaking changes and application crashes during major SDK releases. For more information, refer to unpkg.com.
NPM
If you use a package manager, install the legacy voximplant-websdk package:
or
Initialize the SDK
Obtain the Voximplant client instance via VoxImplant.getInstance and initialize it with Client.init.
When initializing and connecting the SDK to the Voximplant Cloud, you need to specify the node to connect to. Your node is bound to your Voximplant account. To find which node your account belongs to, log in to your control panel and see the Credentials for working with API, SDK, SIP section on the main dashboard.
Legacy connection and authentication flow
To establish a connection to the Voximplant Cloud, use the Client.connect method. Once connected, authenticate the user with the Client.login method:
For detailed documentation on the legacy API, see the Web SDK v4 reference.