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
▸ 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
Name | Type | Description |
---|---|---|
userOptions | Object | |
userOptions.logLevel? | "debug" | "trace" | "info" | "warn" | "error" | "silent" | logging level |
userOptions.project? | string | SignalWire project id, e.g. |
userOptions.token | string | SignalWire project token, e.g. |
Returns
Promise
<RealtimeClient
>
an instance of a real-time Client.
Example
const client = await createClient({
project: '<project-id>',
token: '<project-token>'
})
▸ Const
getConfig(): GlobalConfig
Returns
GlobalConfig