Urgent.News

What's breaking now, across thousands of outlets.

Tech

WebRTC at Scale

Web Real-Time Communication (or WebRTC) is the open standard browsers use to send audio, video, and data straight to each other. There's no plugin or native app, nothing beyond an API that every browser already ships. WebRTC covers the media path: once two peers have found each other, everything from codec negotiation to encoding to transport is handled. What it never covers is the finding part.…

WebRTC is an open standard that enables browsers to send audio, video, and data directly to each other without needing a plugin or native app. It covers the media path, negotiating codecs, encoding, decoding, and transmitting the media stream once a connection is established. However, it does not cover the initial finding of a remote peer, leaving that task to signaling.

Signaling involves exchanging descriptions of what each peer is capable of, such as codecs, network information, and media types, using protocols like WebSockets or HTTP long polling. This exchange follows a specific format, with the peer initiating the call sending an offer and the receiving peer answering with an answer.

NAT traversal is handled by ICE (Interactive Connectivity Establishment), which gathers possible addresses a peer might be reachable at and tests them until a successful connection is established. These addresses include host candidates from the peer's network interface, server-reflexive candidates from STUN servers, and relay candidates allocated on TURN servers. STUN is used for common cases, while TURN serves as a fallback for more complex network configurations.

The implementation of a signaling server can be done using Node.js, Express, and Socket.IO for handling concurrent WebSocket connections. An example implementation involves creating an RTCPeerConnection, generating an offer, setting local and remote descriptions, and sending the offer and answer via the signaling channel. The receiving side adds each ICE candidate as it arrives to the peer connection.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Commit That Wouldn’t Merge

The Invalid State of PR #48 The merge button was gray. Thirty cycles in, that was the only signal worth watching. Status checks passed, linter reported green, CI pipeline finished.

More from Sunday 20 September →