Initializing the SDK

This document explains how to integrate the Communications Client SDKs into your application. If you use UI components, please refer to the UXKit.

Add the SDK into your application

To add the Communications SDK for Web into your application, you can either use a package manager or insert the proper script inside your HTML file.

If you want to use a package manager, add @voxeet/voxeet-web-sdk to your application by using the npm or yarn command, as in the following examples:

npm i @voxeet/voxeet-web-sdk
yarn add @voxeet/voxeet-web-sdk

If you want to use a CDN, add the following script to your HTML file:


Initialize the SDK

The client SDKs provide the initializeToken method to authenticate against the service. For more information, see the section titled Initialize the SDK with secure authentication.

When the application has received the access token from the customer’s server, it can initialize the SDK with:

fetch(serverURL + '/api/token')
 .then(data => data.json())
 .then(result => {
 access_token = result.access_token

 VoxeetSDK.initializeToken(access_token, () => {
 // This callback is called when the token needs to be refreshed. See the next section for details.
 }).catch(error => {
 // An Error has occured

Refresh authentication

An access token has a limited period of validity and needs periodic refreshing. In the application, the Communications Client SDKs invokes the callback provided to the initialize call when the access token needs to be refreshed. This callback contacts the customer’s server, which in turn calls the /oauth2/token API again and returns the refreshed token, which is passed back to the Client SDK by the application.

When the application has received the refreshed access token from the customer’s server, it can pass this to the SDK with this change:

The callback to `VoxeetSDK.initializeToken` must return a Promise containing 
the refreshed access token

const url = serverURL + '/api/token';
 .then(data => data.json())
 .then(json => {
 VoxeetSDK.initializeToken(json.access_token, () => {
 // This callback is called when the token needs to be refreshed.

 // Call the server to get a new access token
 return fetch(url)
 .then(data => data.json())
 .then(json => json.access_token)
 .catch(error => {
 // An error has occurred
 .then(() => {
 // Initialize your application
 .catch(error => {
 // An error has occurred

Open a session

/* Example of participantInfo */
await{ name: "John Doe" })

Close a session

await VoxeetSDK.session.close()


The Communications Client SDKs is integrated with your application, so you have access to all SDK functionalities.

Now you can easily configure your SDK. Tutorials available in the left-side navigation panel and reference documentation guides how to do it.

Did this page help you?