WebRTC
Standardized by W3C and IETF
WebRTC is a standard that enables real-time, peer-to-peer audio, video, and data communication directly between browsers or applications, without necessarily routing media through a central server. It provides the APIs and underlying…
Definition
WebRTC is a standard that enables real-time, peer-to-peer audio, video, and data communication directly between browsers or applications, without necessarily routing media through a central server. It provides the APIs and underlying protocols for capturing media, negotiating a connection between peers, and streaming that media or arbitrary data with low latency, forming the basis for browser-based video calling and live communication features.
Overview
Before WebRTC, real-time audio and video communication on the web generally required proprietary browser plugins or dedicated native applications, since browsers had no built-in way to capture a camera and microphone or establish a low-latency connection to another peer. WebRTC was created to bring real-time communication natively into the browser, standardizing both the JavaScript APIs web developers use and the underlying network protocols that make peer-to-peer media and data exchange possible without a plugin. Mechanically, WebRTC combines several pieces: APIs like getUserMedia for capturing camera and microphone input, RTCPeerConnection for establishing and managing the connection between peers, and RTCDataChannel for sending arbitrary data alongside or instead of media. Because peers are often behind firewalls or NAT devices that prevent direct connections, WebRTC uses protocols like STUN to discover a peer's public network address and TURN as a fallback relay server when a direct peer-to-peer path isn't possible, with a signaling mechanism, left unspecified by WebRTC itself, used to exchange connection details before the peer connection is established. WebRTC differs from WebSockets in that its primary purpose is real-time media and data transport optimized for low latency, often peer-to-peer, whereas WebSockets is a general-purpose bidirectional messaging protocol that always flows through a server. In practice, many WebRTC applications still use a server for signaling and, when needed, TURN relaying, but the media path itself can bypass the server entirely for peer-to-peer calls, unlike WebSockets, which structurally requires a server participant in the connection. In practice, WebRTC underlies browser-based video conferencing products, voice calling features embedded in web applications, live streaming with minimal delay, and peer-to-peer file sharing or gaming data channels. Developers typically build on top of raw WebRTC APIs using higher-level SDKs or media server platforms that handle the complexity of managing many simultaneous peer connections for group calls. WebRTC's main complexity lies in NAT traversal and signaling, which the standard leaves partially unspecified, requiring developers to implement or adopt a signaling server and, often, a TURN relay for reliability across different network conditions. Scaling WebRTC to many-participant group calls typically requires a selective forwarding unit or media server architecture rather than pure peer-to-peer mesh connections, since peer-to-peer connections scale poorly as participant count grows. Teams needing simple one-way media broadcast without interactivity often reach for standard streaming protocols instead of WebRTC's peer-to-peer model, since those protocols are built around efficient one-to-many distribution rather than direct interactive connections between individual participants.
Specification
- Enables real-time peer-to-peer audio, video, and data communication
- Provides getUserMedia for capturing camera and microphone input
- Uses RTCPeerConnection to establish and manage peer connections
- Supports RTCDataChannel for arbitrary low-latency data exchange
- Relies on STUN and TURN for NAT traversal and connection fallback
- Leaves signaling implementation unspecified, requiring a separate mechanism
- Forms the basis for native browser video calling without plugins