webrtc

An async-friendly, pure-Rust implementation of the full WebRTC stack for real-time peer-to-peer communication.

Library
Cargo
v0.21.0-beta.1
5,121stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity100
Maintenance96
Community72
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
87/100Excellent
Architecture90
Code Quality88
Innovation85
Learning Curve45

webrtc is a pure-Rust implementation of the WebRTC API, letting Rust applications establish real-time peer-to-peer connections for data channels, audio, and video without depending on the C++ libwebrtc. It ports the layered WebRTC protocol stack—ICE, DTLS, SCTP, SRTP, RTP/RTCP, and the peer-connection API—into idiomatic, async-friendly Rust crates.

Built to run on async runtimes (tokio by default, with smol support), webrtc powers servers and clients that need low-latency, NAT-traversing communication: SFUs, game networking, browser-to-native links, and IoT streaming. It is the flagship crate of the webrtc-rs project, which maintains the underlying protocol crates as a coherent, well-tested ecosystem.

What You Get

  • A high-level RTCPeerConnection API mirroring the browser WebRTC model
  • Data channels for reliable and unreliable peer-to-peer messaging
  • Media streaming with RTP/RTCP and SRTP encryption for audio and video tracks
  • A complete protocol stack (ICE, DTLS, SCTP, SRTP) implemented in pure Rust with tokio and smol runtime support

Common Use Cases

  • Building Selective Forwarding Units (SFUs) and media servers in Rust
  • Adding low-latency peer-to-peer data channels to games and collaborative apps
  • Bridging browsers and native Rust services over WebRTC
  • Streaming audio/video from IoT or embedded devices with NAT traversal

Under The Hood

Architecture The top-level webrtc crate provides the async, runtime-driven API and delegates the sans-I/O protocol logic to an internal rtc crate (referenced as a path dependency). Its src/ splits cleanly along WebRTC’s object model—peer_connection, data_channel, media_stream, rtp_transceiver, and a runtime abstraction—so the public surface mirrors the browser API while the transport, ICE, DTLS, SCTP, and SRTP concerns live below. The runtime layer lets the same protocol core run on tokio or smol.

Tech Stack It is a Rust crate on edition 2024 depending on bytes, futures, async-trait, and log, with optional tokio (plus quinn-udp) or smol runtimes selected by feature flags. The workspace bundles the rtc protocol crates and a large examples/ and tests/ tree; codecov integration is configured.

Code Quality The project is mature and very actively developed (roughly 20+ commits/month, 169 contributors), with CI, dependency auditing (deps.rs), and code coverage badges. The dozens of runnable examples double as integration tests and documentation, and the sans-I/O split makes the protocol logic independently testable from the async plumbing.

API Design The API deliberately follows the W3C WebRTC model (RTCPeerConnection, data channels, SDP offer/answer), so web developers find it familiar, but WebRTC itself is inherently complex—signaling, ICE candidates, and media negotiation impose a steep learning curve regardless of language. The extensive examples substantially soften the onboarding cost.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search