WebRTC is an open-source project that provides web browsers and mobile applications with real-time communication (RTC) capabilities via simple application programming interfaces (APIs). It allows audio and video communication to work inside web pages by allowing direct peer-to-peer communication, eliminating the need to install plugins or download native apps.
WebRTC enables peer-to-peer communication, but it still needs servers to establish the connection.
WebRTC is the standard for browser-based real-time media.
Use WebRTC when:
| Pros | Cons |
|---|---|
| Low Latency: Direct peer-to-peer connection minimizes delay, ideal for real-time interaction. | Complexity: Setting up the infrastructure (Signaling, STUN, TURN) is complex. |
| Bandwidth Efficiency: Reduces server load as media flows directly between users (except when using TURN). | UDP Reliability: Uses UDP, so packet loss can occur (video glitches), though it handles congestion well. |
| Security: Encryption (DTLS/SRTP) is mandatory and built-in. | Scalability: Mesh networking (connecting everyone to everyone) doesn’t scale well for large groups; requires SFU/MCU servers. |
| No Plugins: Native support in all modern browsers without external software. | Network Traversal: Corporate firewalls and NATs can block connections, requiring fallback to expensive TURN servers. |