WebRTC, short for Web Real-Time Communication, is a set of browser APIs and underlying network protocols that let web applications capture audio and video and exchange media and arbitrary data directly between browsers, or between a browser and a server, without plug-ins. The APIs are standardised by the W3C and the protocols by the IETF. In a browser, the main entry points are RTCPeerConnection for the connection itself, RTCDataChannel for data, and MediaStream objects obtained from getUserMedia.
WebRTC is best understood as a stack rather than a single protocol. Session negotiation happens through a channel the application provides, path discovery uses ICE with STUN and TURN servers, and media and data travel over encrypted transports. This article walks through signaling and peer connections, ICE, STUN and TURN, the media, data channel and permission layers, and the limits that follow from the design.
Signaling and Peer Connections
Before two peers can exchange media they must agree on what to send and where. WebRTC deliberately leaves this signaling step out of the specification. MDN's connectivity guide states that the signaling channel is up to the application: a WebSocket connection to the application's server is common, but any channel that can carry text works. There is no built-in signaling server inside the browser, and services also differ in media-server architecture, authentication and routing.
The negotiation follows an offer and answer model using the Session Description Protocol, SDP. The caller creates an offer that describes its media tracks, codecs and transport parameters, applies it as the local description and sends it through the signaling channel. The callee sets it as the remote description, creates an answer and returns it. Each RTCPeerConnection holds a local and a remote description, and changes that require renegotiation trigger another exchange, for example adding a new media section.
The signaling service commonly handles these descriptions, including fingerprints used to check the peer's transport certificate. A fingerprint establishes continuity only with the description received; an attacker who can replace the signaling can replace that fingerprint too. Authenticating the intended participant therefore requires trustworthy signaling or an additional identity-verification mechanism. Encryption alone does not prove who the remote person is.
ICE, STUN and TURN
Most devices sit behind NAT and firewalls, so neither peer knows an address the other can reach. Interactive Connectivity Establishment, defined in RFC 8445, solves this by having each peer gather candidate addresses, exchange them through signaling and check suitable candidate pairs to find a working path.
Candidate Types
ICE candidates come in four kinds. Host candidates are addresses bound to local interfaces, including VPN interfaces. Server-reflexive candidates are the public addresses a NAT presents, learned by asking a STUN server. Relayed candidates are addresses allocated on a TURN server. Peer-reflexive candidates are discovered during the checks themselves. Candidates are prioritised, and UDP paths are generally preferred over TCP. In the browser, candidates arrive through RTCPeerConnection events and are sent to the other side as they appear, a pattern called trickle ICE.
STUN
STUN, Session Traversal Utilities for NAT, is specified in RFC 8489. A client sends a binding request to a STUN server, usually on port 3478, and the server replies with the source address it saw, which is the mapped address visible on that particular path, whether or not a NAT changed it. STUN also provides connectivity checks and keepalives, but the RFC is explicit that STUN is not a NAT traversal solution by itself; it is a tool used inside ICE.
TURN
When no direct path works, for example because both peers are behind NATs with address-dependent mapping, a TURN relay candidate can provide a usable path, Traversal Using Relays around NAT, defined in RFC 8656. The client creates an allocation on the TURN server and receives a relayed address; peers send to that address and the server forwards the packets. Relaying is dependable but costs the operator bandwidth, so candidate preferences usually favour a workable direct path. An application can also force relaying by setting the ICE transport policy to relay, which restricts the connection to relay candidates.
Candidate gathering can reveal network addresses to the application and peer, subject to browser policy. Browsers can mask local addresses with mDNS hostnames or limit which interfaces participate. This is normal WebRTC behaviour, and RFC 8828 defines how browsers limit it, describing gathering modes with different privacy and connectivity trade-offs. Whether an exposed address amounts to a WebRTC leak is a separate question covered in its own glossary entry.
Media, Data Channels and Permissions
Audio and video travel as RTP packets protected by SRTP, with keys established through DTLS. RFC 8827 makes this mandatory: unencrypted media is prohibited. Codecs, resolutions and directions are negotiated in SDP, and a connection can carry several tracks at once.
Data channels, defined in RFC 8831, run over SCTP encapsulated in DTLS on the same ICE transport. Each channel can be configured as reliable or unreliable and ordered or unordered, so a file transfer can use reliable ordered delivery while a game sends unreliable position updates on another channel of the same connection. The RTCDataChannel API is intentionally similar to WebSocket, and a data-only connection needs no camera or microphone.
Media capture is gated by permission. The getUserMedia method requires permission before capture, requesting it when an applicable grant has not already been given, works only in secure contexts such as HTTPS, and browsers must display an indicator while a camera or microphone is in use. Cross-origin embedded frames need permission delegation from the top-level page as well as user permission. Capture is independent of networking: a page can show a local preview without ever creating a peer connection.
Common Uses
Browser video calling and conferencing are the original use case, including screen sharing. Data channels support peer-to-peer file transfer, collaborative editing and multiplayer game state. Low-latency broadcast and remote control of devices use the media path with a server acting as a peer. The same connectivity machinery is used by diagnostic pages that gather ICE candidates to show which addresses a browser would expose.
Limitations
WebRTC does not guarantee a direct connection, and deployments without a TURN server fail for users behind restrictive NATs. On networks that block UDP, compatible TURN servers may carry traffic over TCP or TLS. This can add delay or head-of-line blocking, but the actual experience depends on the route and workload. Browser implementations differ in supported features and behaviour, so applications need compatibility testing; a shim can address some API differences. Signaling, authentication and presence must be built by the application. Finally, the address gathering that makes direct connections possible is also the reason WebRTC appears in privacy discussions, and the browser's gathering mode together with the application's transport policy decide how much is exposed.