Skip to main content

RELAY JS SDK 3.8.0 Release

· 2 min read
Daniele Di Sarli

We are happy to announce JavaScript SDK 3.8.0.

Upgrading is straightforward with our release process, which adheres to Semantic Versioning. Minor versions are guaranteed to not have breaking changes, so you can upgrade with confidence.

SignalWire Release Card

This release of the JavaScript SDK marks the introduction of Chat APIs. We have also made some additional improvements to our Video APIs to make it easier to use.

Highlights

Chat

You can now use our JavaScript SDK to create chat applications, or to add chat functionalities to your existing video applications. To get started, include the SDK as usual, for example from unpkg:

<script src="https://unpkg.com/@signalwire/js@3"></script>

You will now be able to access the SignalWire.Chat namespace. Joining a chat is similar to how you join Room Sessions:

const chatClient = new SignalWire.Chat.Client({
token: token // Get this from our REST APIs
});

// Subscribe to events
chatClient.on("message", message => { })

// Start receiving messages
await chatClient.subscribe(['channel1', 'channel2']);

// Publish a message
await chatClient.publish({
channel: 'channel1',
content: 'Hello!'
});

Please explore the following resources for more information:

List of members in a video room

We have introduced an additional event for RoomSession objects: memberList.updated. You will find this event handy if you're aiming to build a dynamically updated list of members in a room. You can use it like this:

roomSession.on('memberList.updated', (e) => {
// e.members contains the full list of members currently in the room.
updateMyListOfMembers(e.members)
})

In this way, you don't need to manually keep track of member.joined, member.updated, and member.left events to keep your UI updated.