Skip to main content

Overview

caution

The RELAY v4 is the most up-to-date version of the Realtime Relay SDK. Consider reading the Upgrading to Relay v4 page to understand the benefits of RELAY v4 and how to upgrade.

The SignalWire Realtime SDK v3 revolutionizes real-time communication by simplifying the creation and management of various communication services. Through the straightforward installation process and the initiation of a realtime client, developers can easily engage with Video, Chat, Messaging, PubSub, Tasks, and Voice functionalities. The transition to v3 emphasizes ease of use with product-specific constructors, eliminating the need for manual client creation, and offering an enhanced event-driven model for more intuitive interaction and control over communication services.

Installation

npm install @signalwire/realtime-api@~3

Get started

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

Classes

Functions

createClient

Const createClient(userOptions): Promise<RealtimeClient> ⚠️ Deprecated. — See RealtimeClient for more details.

⚠️ 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?stringSignalWire project id, e.g. a10d8a9f-2166-4e82-56ff-118bc3a4840f
userOptions.tokenstringSignalWire project token, e.g. PT9e5660c101cd140a1c93a0197640a369cf5f16975a0079c9

Returns

Promise<RealtimeClient> ⚠️ Deprecated. — See RealtimeClient for more details.

an instance of a real-time Client.

Example

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

getConfig

Const getConfig(): GlobalConfig

Returns

GlobalConfig