Introducing Eleven v4Meet Eleven v4, our most emotive model yet.
DiscoverSkip to contentLog inSign upContact salesLog inSeamless web communication feels effortless today. But building a low-latency video or voice streaming app used to be a major hurdle for developers. Users had to deal with dropped frames, audio lag, and disconnections that marred interactions.
WebRTC helps developers address shortcomings in real-time web communications by enabling low-latency peer-to-peer data streaming. Since its introduction in 2011, major browsers, including Chrome, Safari, and Firefox, have adopted WebRTC. Today, WebRTC supports real-time communication in browsers and web apps.
This article explores how WebRTC works, its use cases, security considerations, and how it compares with other web communication technologies.
Summary
- WebRTC is a technology that allows peer-to-peer real-time streaming of audio, video, and data between browsers or web apps.
- WebRTC operates with UDP, making it suitable for low-latency, loss-tolerant web communication applications.
- To stream with WebRTC, you use standard APIs such as RTCPeerConnection, MediaStream, and RTCDataChannel, which create an encrypted channel for real-time media exchange.
- Peer devices rely on STUN and TURN servers to discover their IP address and overcome network restrictions when establishing WebRTC connections.
- Developers must consider several challenges, including scalability, security, and connectivity, when building WebRTC applications.
What is WebRTC?
WebRTC is a free, open-source communication technology that enables peer-to-peer, real-time streaming between web browsers. With WebRTC, users can exchange video, audio, and data directly without downloading plugins or intermediary software.
Unlike traditional client-server streaming, WebRTC sends media directly between peers whenever a direct path exists. Relay (TURN) servers and media servers step in only when a direct connection isn’t possible or when more than two participants join. This allows WebRTC to deliver low-latency real-time media.
Modern web browsers support WebRTC by default. WebRTC is an open standard from the W3C and IETF that exposes JavaScript APIs, which let you access the camera and microphone, create a data channel, and deliver media content to the destination.
Because of its simplicity, developers use WebRTC to power various web applications, including teleconferencing, video and audio streaming, real-time transcription, and screen sharing.

How WebRTC works: from signaling to peer-to-peer media
WebRTC captures data in a browser, encrypts it, and streams it to another browser in real time. It creates a data channel over the User Datagram Protocol (UDP), where browsers or web apps can exchange data with low latency. UDP is a fast, connectionless protocol that sends data packets across networks. It doesn’t need to maintain a connection, acknowledge packet reception, or retransmit lost packets, resulting in significantly lower overhead.
By default, the native WebRTC API supports direct peer-to-peer (P2P) streaming between two browsers. However, more than two browsers can exchange data by creating multiple P2P connections or using a media server. Often, upstream bandwidth limits multiple P2P connections, making a media server a better option for applications like live conferencing.
Below, we use an example that demonstrates video between two browsers to explain how it works.
To create a WebRTC connection, both browsers follow these sequences.
- Media capture. Before capturing data, the browser asks the user for permission to access their microphone, camera, or screen. This is a default security feature built within the WebRTC framework that developers cannot bypass.
- Signaling. This process lets both browsers negotiate metadata through signaling servers to enable successful data exchange. For example, browser A sends the codec, bitrate, and encryption technologies it supports. Then, it waits for browser B to respond with corresponding metadata. Both browsers must agree on a common set of metadata before they can exchange data.
- Securing the channel. WebRTC encrypts media and data in transit to protect them from unauthorized parties. Both browsers exchange cryptographic keys using the Datagram Transport Layer Security (DTLS), which they use to encrypt and decrypt data. Each hop is encrypted separately, so a media server or SFU can access the media unless you add end-to-end encryption on top, for example with insertable streams.
- Media exchange. Once the browsers have negotiated a cryptographic key, they exchange media using the Secure Real-time Transport Protocol (SRTP). The sender will encrypt all outgoing video, audio, and other arbitrary data using AES-128. Meanwhile, the device uses the Stream Control Transmission Protocol (SCTP) to send arbitrary data such as JSON and text files.
- Congestion management. Devices actively detect jitter, lags, or other signs of degradation. A device sends Real-time Transport Control Protocol (RTCP) packets to a peer. Then, it examines the RTCP response using a bandwidth estimation algorithm called Google Congestion Control and adjusts its transmission rate accordingly.
The WebRTC standards provide application programming interfaces (API) and guidelines for media capture, data security, and media exchange. However, it doesn’t define a signaling framework. Therefore, developers implement signaling through different mechanisms, such as WebSockets.
Supported WebRTC codecs
A codec is an algorithm that compresses and decompresses media streams. All WebRTC-compliant browsers must support the following codecs.
- Video: VP8, H.264.
- Audio: Opus, G.711 PCM (A-law), G.711 PCM (µ-law).
However, some browsers may support newer codecs, such as AV1 and VP9.

The WebRTC API: RTCPeerConnection, MediaStream, and data channels
WebRTC exposes three core APIs to developers in the browser runtime.
- RTCPeerConnection handles connection discovery, metadata negotiation, security handshaking, and encryption. It lets you add video and audio streams, which the device sends to its peer.
- MediaStream is an object that contains the content you want to stream. You populate it by calling getUserMedia(), which passes the camera and microphone input to the MediaStream instance.
- RTCDataChannel is a data channel created to send arbitrary data between peer browsers.

Why WebRTC uses STUN and TURN servers
Most WebRTC connections happen between devices located in different networks. They need their peer’s public IP address to exchange data. However, devices are often located behind a firewall, router, or within a protected network. These devices don’t always know their public IP address, which complicates connection efforts.

Routers use Network Address Translation (NAT) to map private addresses to a public one. WebRTC then uses Interactive Connectivity Establishment (ICE) to find a working path between peers.
NAT is a service that allows devices in a local network to share a single public IP address. For example, your computer has a private IP address of 192.168.1.104. With NAT, your router maps it to a public IP address of 210.195.229.181 when it connects to the internet. When you send a data packet to the public IP address, the router identifies the corresponding private IP address and local port and delivers the data to it.
ICE is a framework that allows peer devices to discover each other. Devices will first attempt to establish a connection using the public IP address they discover through a STUN server. If that fails, they revert to an intermediary relay server. Both STUN and TURN servers operate within the ICE framework to enable successful peer connection.
- A Session Traversal Utilities for NAT (STUN) server provides a device with its own public IP address and external port. Once it knows its public IP address, the device sends it to peers that want to establish a connection over the internet.
- A Traversal Using Relays around NAT (TURN) server provides an alternative way for establishing WebRTC connections. The TURN server provides a relay address that both peers use to exchange data. When peers can't establish a connection despite knowing their public IP address, they fall back to TURN.

What is a media server in WebRTC?
A media server is an intermediary server that routes data between devices in the WebRTC architecture. While a WebRTC media server isn’t mandatory, it is useful when a device needs to stream to multiple peers at once. A WebRTC media server offloads the burden of processing, encryption, and routing to destination devices.
WebRTC vs WebSocket: which protocol should you use?
WebSocket is a protocol that allows bidirectional data exchange between a client and server. It runs over the Transmission Control Protocol (TCP), which provides reliable, ordered delivery. Meanwhile, WebRTC provides peer-to-peer streaming capabilities using UDP, which has lower latency and is optimized for real-time transmission.
WebRTC is better when you want to stream high-definition video and cannot afford lag or degradation. Meanwhile, WebSocket is suitable for maintaining a persistent connection where applications can reliably exchange messages with the backend server.
WebRTC and WebSocket are not competing protocols. In fact, to establish a WebRTC connection, devices use WebSockets for signaling. WebSocket is built for event-driven messages, allowing devices to send and receive networking parameters, media metadata, and other alerts.

WebRTC use cases for real-time voice, video, and data
WebRTC has become the standard for low-latency streaming across web apps and browsers. Over the years, developers have leveraged WebRTC to support these applications.
- Video conferencing. Meeting attendees can interact, share screens, and transcribe in real time over video calls.
- Voice calls. WebRTC supports audio conversations on messaging apps, contact centers, and browser-based phones.
- Internet of Things. IoT devices stream video and audio data from home cameras, drones, and doorbell cameras to mobile apps using WebRTC.
- Telehealth. Doctors and patients hold consultations remotely using browser-based apps with WebRTC support.
- Interactive live streaming. Content creators, gamers, and entertainers interact with their audiences in real time using WebRTC capabilities.
- AI voice agents. WebRTC lets AI voice agents have natural, multi-turn conversations.

Is WebRTC an API, protocol, or platform?
WebRTC is a set of APIs built on top of several protocols. Developers use WebRTC APIs that are built into browsers or available as SDKs to build low-latency voice and video streaming applications. For example, they call APIs like getUserMedia, RTCPeerConnection, and RTCDataChannel to establish RTC connections and exchange data bidirectionally.
You can also think of WebRTC as a suite of protocols working together to enable real-time streaming.
Protocol
Function
Datagram Transport Layer Security (DTLS)
Provides initial encryption and authentication handshaking to secure WebRTC data.
Secure Real-time Transport Protocol (SRTP)
Encrypts WebRTC payloads that are being streamed to peer devices.
Real-time Transport Control Protocol (RTCP)
Provides congestion control.
Stream Control Transmission Protocol (SCTP)
Allows devices to send data in an orderly manner
Session Traversal Utilities for NAT (STUN)
Enables a device to discover its public IP address, which it then sends to peer devices.
Traversal Using Relays around NAT (TURN)
Offers a relay address through an intermediary server that peers use if they fail to establish a direct connection.
While WebRTC provides the fundamentals for streaming audio, video, or other data types, it is not a platform. WebRTC doesn’t provide the frameworks, infrastructure, or signaling mechanisms needed to facilitate data exchange.

WebRTC limitations, security considerations, and tradeoffs
While WebRTC offers low-latency bidirectional communication, developers face several real-world implementation challenges.
Scalability
WebRTC faces a performance bottleneck when multiple participants join the mesh network. For example, if five participants join a live video conference, a device must stream video data to the other four participants at once. This stresses the computer's resources and bandwidth, eventually degrading streaming quality.
Connectivity issues
Devices might not be able to establish a peer-to-peer connection using STUN if they’re behind firewalls or symmetric NAT. Symmetric NAT maps public-facing ports to specific destinations, which restricts peer-to-peer communication. In those cases, WebRTC falls back to TURN, which increases end-to-end latency.
Security considerations
While WebRTC automatically encrypts data in transit, several challenges remain.
- A device’s local or public IP address is exposed when it connects to a peer, which can raise privacy concerns.
- Developers must use a secure signaling protocol, such as HTTPS or WSS. Otherwise, bad actors can intercept the WebRTC connection.
- WebRTC doesn’t handle application-level security. You must apply mitigative features, such as authentication, to prevent unauthorized users from joining a call.
Signaling consistency
Without a standardized signaling framework, developers may use different signaling mechanisms, which can lead to conflicting or misaligned negotiation messages. This can cause devices to try several times before successfully negotiating a WebRTC connection.

Get started with ElevenAgents for real-time voice experiences
ElevenAgents lets you build real-time voice agents that connect over WebRTC. In the JavaScript and React SDKs, voice conversations use WebRTC by default and text-only conversations use WebSocket. You can set connectionType to 'webrtc' or 'websocket' in startSession to choose explicitly. WebRTC is available in the React, Swift, and React Native SDKs, and in the Unity SDK on WebGL builds. WebRTC brings browser-native echo cancellation and background noise suppression, which helps keep audio clear in AI conversations.
Learn more about ElevenAgents or contact sales to get started with conversational AI agents at scale.
FAQ
WebRTC is a peer-to-peer real-time streaming web technology for exchanging audio, video, and other arbitrary data. Meanwhile, WebSocket is an event-messaging protocol that allows bi-directional communication between server and client. WebRTC uses UDP to send data packets, while WebSocket relies on TCP.
WebRTC exposes a device's private or public IP address to its peers. Without mitigation, this can raise security concerns. Additionally, devices might fail to establish a peer-to-peer connection, requiring a TURN server to act as an intermediary in a potentially complex and costly setup.
Modern browsers, including Google Chrome, Mozilla Firefox, Apple Safari, and Microsoft Edge support WebRTC. They support core APIs like getUserMedia, RTCDataChannel, and RTCPeerConnection. While browsers support VP8 and H.264, support for newer codecs like VP9 and AV1 may vary.
WebRTC provides a low-latency data transport layer that AI agents use to stream conversations with users. By running over UDP, a lost packet does not stall the stream, and a built-in jitter buffer streamlines the playback experience.
Zoom uses WebRTC for parts of its browser-based client, alongside proprietary libraries. For one-to-one calls, Zoom may switch to WebRTC. However, Zoom’s desktop and mobile clients rely on proprietary technology instead of WebRTC. Zoom added WebRTC support to its Video SDK for web with version 2, announced in December 2024. This lets developers add WebRTC video conferencing to their apps using Zoom’s architecture.
Written by

Growth Marketing
View profileJack Limebear is on the Growth team, acting as a content writer and strategist across the blog and insights pages. Before ElevenLabs, he spent over a decade leading content strategy for organizations ranging from fast-growing SaaS startups to Fortune 500 companies. He holds a Master's degree in English Literature from the University of Cambridge.
Similar articles

What is turn taking in conversational AI: A guide to natural flow
CategoryResourcesDateOct 29, 2026
Conversational AI in banking: Use cases, benefits, examples
CategoryResourcesDateOct 28, 2026
What is an LLM? A practical guide to language models
CategoryResourcesDateNov 16, 2026
7 customer service skills every human and AI agent needs (with examples)
CategoryResourcesDateNov 12, 2026
Create with the highest quality AI Audio
Talk to salesSign up
AI 热点