Skip to main content

RELAY Realtime SDK 3.0.0

· 2 min read
Renae Sowald

We are happy to announce the release for the Relay Realtime-API SDK 3.0.0!

This Is A Major Release

When upgrading to this version from a previous version, please be aware that there may be breaking changes. Please check out our RELAY Realtime SDK vs RELAY SDK for more information.

Future updates will adhere to Semantic Versioning. This means you can upgrade with confidence knowing that new versions will not break your version from minor updates.

SignalWire Release Card

This release marks the beginning of the RELAY Realtime SDK with the integration of Voice and Messaging RELAY with our existing Realtime SDK for Video and Chat.

Highlights

Voice

You can now instantiate a Voice Client, subscribe to events, and make and answer calls. For example:

import { Voice } from '@signalwire/realtime-api';

const client = new Voice.Client({
project: '<project-id>',
token: '<project-token>',
contexts: '<context>'
});

client.on('call.received', async (call) => {
console.log('Got call', call.id, call.from, call.to, call.direction);
});

try {
const call = await client.dialPhone({
to: 'to number',
from: 'from number',
timeout: 30,
})
console.log('Dial resolved!', call.id)
} catch (error) {
console.error('Connect Error', error)
};

With Voice, you can also

  • record audio
  • play audio
  • listen for digits or speech using prompt()

Messaging

You can use the same structure to instantiate a Messaging Client, subscribe to events, and send and receive messages.

import { Messaging } from '@signalwire/realtime-api';

const client = new Messaging.Client({
project: '<project-id>',
token: '<project-token>',
contexts: '<context>'
});

client.on('message.received', (message) => {
console.log('message.received', message)
})

try {
const response = await client.send({
from: '+1xxx',
to: '+1yyy',
body: 'Hello World!',
})
console.log('>> send response', response)
} catch (error) {
console.log('>> send error', error)
}

Fixes

  • Fix: expose all the active recordings on the room.joined event (#501) 5c96bf8

Improvements

  • We have introduced the PubSub namespace to keep the minimal PubSub functionality available to users as Chat continues to develop (#533) b6d5bb3