Technical Reference
This version of the SDK will be end of life and unsupported starting June 2027. Please consider using the latest version.
The SignalWire Browser SDK is a JavaScript library that enables WebRTC-based voice, video, and chat applications directly in web browsers. Built on WebSocket architecture, it provides real-time communication capabilities without plugins or downloads.
Core Concepts
The SDK operates through WebSocket connections that handle both method calls and real-time events.
When you call methods like join() or publish(), the SDK sends requests and returns promises.
Simultaneously, you can listen for real-time events like new members joining or messages arriving using the .on() method.
Namespaces
WebSocket Event Architecture
The SDK operates on a bidirectional WebSocket connection between your browser application and SignalWire’s servers. This enables real-time communication through a structured event system:
When you call a method like roomSession.join(), the SDK sends your request over the WebSocket connection and SignalWire processes it and responds immediately. These method calls follow a request-response pattern - the returned promise resolves with the result data, such as joining a video room or publishing a message.
The .on() methods handle a different communication pattern: real-time event notifications. These are asynchronous events triggered by external actions - like when someone joins your video room (member.joined), sends you a message (message.received), or when device states change (call.state). Unlike method responses, these events arrive whenever the triggering action occurs, not as a direct response to your code.
Authentication and Access Control
Browser SDK clients use token-based authentication for security. Since web browsers are untrusted environments where secrets can be exposed, API tokens must be kept on your server and used to generate limited-scope tokens for client use.
Server-to-Browser Authentication Flow
Token Types by Namespace
Different namespaces require specific token types:
Server-Side Token Generation
Your server uses Project ID and API Token to generate limited-scope tokens:
This approach ensures your project credentials never expose to client-side code while providing scoped access to specific rooms, channels, or resources.