Get Started

Installation

To retrieve the Crewdle SDK. You must simply install our NPM package with the following command.

npm install @crewdle/web-sdk

You can also visit our NPM page.

Supported browsers

As of now, the Crewdle SDK is fully suported on Google Chrome only.

Setting up your project

Initiating the SDK

To start using the Crewdle SDK, you must initiate an instance and authenticate a user. You can generate your vendor ID and access token using the Crewdle Developer Console. To do so, log in and navigate to "Account." You may also pass options to the SDK instantiation to specify specific optional properties.

import { ILoggingConnector } from '@crewdle/web-sdk-types';
import { SDK } from '@crewdle/web-sdk';

const credentials = {
  id: 'crewdleUser',
  displayName: 'crewdleUser',
  email: '[email protected]'
}

const loggingConnector: ILoggingConnector = {
  log: (message: string, data: any) => {},
  error: (message: string, data: any) => {},
  warn: (message: string, data: any) => {},
};

const options = {
  // Audio context for audio processing
  audioContext: new AudioContext(),
  // The interval hack ensures the intervals are run at the correct time. Disabling it will make the intervals unpredictable.
  disableIntervalHack: true;
  // Custom logging connector for logging events
  loggingConnector: loggingConnector,
  // Minimum number of initial connections
  minConnections: 3,
  // Maximum distance between two users
  maxDistance: 10,
}

const sdk = await SDK.getInstance('CREWDLE_VENDOR_ID', 'CREWDLE_ACCESS_TOKEN', options);
const authUser = await sdk.authenticateUser(credentials);

Furthermore, we use clusters to allow communication across the network. Crewdle SDK users must join the same cluster to connect and exchange data.

const cluster = await sdk.joinCluster('CLUSTER_ID');

Additional ressources

For more information on the services used in this page, head to our SDK reference