Client API

Every client SDK exposes the same concepts under names that fit the language. This page is the map between them. For full signatures and platform detail, open that platform's page.

Lifecycle#

ConceptWeb / React NativeFlutterAndroidiOS
CreateAppEngine.create({ appId })AppEngine.create(appId:)AppEngine.create(ctx, appId, handler)AppEngine.create(appId:delegate:)
JoinjoinChannel(token, wsUrl, opts)joinChannel(token:wsUrl:options:)joinChannel(token, wsUrl, opts)joinChannel(token:wsUrl:options:)
LeaveleaveChannel()leaveChannel()leaveChannel()leaveChannel()
Releasedestroy()dispose()destroy()leaveChannel()

Leave is not release

leaveChannel ends the call but keeps the engine ready to join again. Release it when the screen is gone, or its listeners live as long as your app does.

Media controls#

ActionMethodNotes
Camera on or offenableCamera(on)No effect for the audience role, which cannot publish.
Microphone on or offenableMicrophone(on)On by default for hosts and co-hosts.
Screen shareenableScreenShare(on)Web and Flutter.
Switch cameraswitchCamera()Web, Android. Flips between front and back where a second camera exists.
Loudspeaker or earpiecesetSpeakerphone(on)Android. A video call is held at arm’s length; the default routing is the earpiece.
Pick a devicesetDevice(kind, deviceId)Web and Electron. Cameras, microphones and speakers by id; see listDevices().
Send datasendData(payload, reliable)See Data messages.

Events#

The names differ by platform idiom — listeners on web, streams in Flutter, a handler on Android, a delegate on iOS — but the set is the same.

EventFires whenPayload
user-joinedSomeone enters the channel, including everyone already present when you join.The remote user
user-leftSomeone leaves, and for everyone when you are disconnected.The remote user
track-subscribedA remote camera or microphone becomes available to render.The track and user (web), the user (other platforms)
track-unsubscribedA remote track stops.The track and user
connection-state-changedConnecting, connected, reconnecting or disconnected.The new state
active-speakers-changedThe set of people currently speaking changes.Array of identities
data-receivedAnother participant sends data.Bytes and the sender
gift-receivedA gift is broadcast to the channel.The gift event
errorA media device or publish operation fails.The error

Render on track-subscribed, not user-joined

A participant is announced before their camera arrives. A UI that builds tiles only on user-joined shows permanently black boxes. This is the single most common integration mistake.

engine.on('user-joined', (user) => addTile(user.uid));
engine.on('track-subscribed', (track, user) => {
document.getElementById(`tile-${user.uid}`).append(track.attach());
});
engine.on('user-left', (user) => removeTile(user.uid));

Reading state#

PropertyTypeDescription
remoteUsersarrayEveryone currently in the channel, excluding you.
connectionStatestring / enumconnecting, connected, reconnecting or disconnected.
localUidstringYour own identity, as issued in the token.
channelNamestringThe channel you are in.

Remote user

PropertyDescription
uidThe identity your server put in their token.
displayNameTheir name, if you set one in the token metadata.
metadataThe JSON your server attached to their token, as a string.
isSpeakingWhether they are speaking right now.
videoTrackTheir camera, when one is published.

Join options#

{
role: 'host' | 'cohost' | 'audience', // must match the token's role
camera: boolean, // publish camera on join
microphone: boolean // publish microphone on join (default true)
}

The role here only decides what the SDK tries to publish. What you are allowed to publish is fixed by the token, so asking for camera: true with an audience token simply publishes nothing.