You can use the realtime SDK to listen for and react to events from SignalWire's RealTime APIs.

To get started, create a realtime client, for example with Video.Client and listen for events. For example:

import { Video } from '@signalwire/realtime-api'

const video = new Video.Client({
  project: '<project-id>',
  token: '<project-token>'
})

video.on('room.started', async (roomSession) => {
  console.log("Room started")

  roomSession.on('member.joined', async (member) => {
    console.log(member)
  })
});

Namespaces

Interfaces

Functions

createClient

Const createClient(userOptions): Promise<RealtimeClient>

️ Deprecated

You no longer need to create the client manually. You can use the product constructors, like Video.Client, to access the same functionality.

Creates a real-time Client.

Parameters

NameTypeDescription
userOptionsObject
userOptions.logLevel?"debug" | "trace" | "info" | "warn" | "error" | "silent"

logging level

userOptions.project?string

SignalWire project id, e.g. a10d8a9f-2166-4e82-56ff-118bc3a4840f

userOptions.tokenstring

SignalWire project token, e.g. PT9e5660c101cd140a1c93a0197640a369cf5f16975a0079c9

Returns

Promise<RealtimeClient>

an instance of a real-time Client.

Example

const client = await createClient({
  project: '<project-id>',
  token: '<project-token>'
})

getConfig

Const getConfig(): GlobalConfig

Returns

GlobalConfig