webrtc-rs
webrtc
Rust

Async-friendly WebRTC implementation in Rust

Last updated Jul 7, 2026
5.1k
Stars
486
Forks
9
Issues
+8
Stars/day
Attention Score
94
Language breakdown
No language data available.
โ–ธ Files click to expand
README

WebRTC.rs

License: MIT/Apache 2.0 Discord Twitter

Async-friendly WebRTC implementation in Rust

Sponsored with ๐Ÿ’– by

Gold Sponsors:
Recall.ai

Silver Sponsors:
Stream Chat
ChannelTalk
Bronze Sponsors:
AdrianEddy

Overview

WebRTC.rs is an async-friendly WebRTC implementation in Rust, originally inspired by and largely rewriting the Pion stack. The v0.20.x line is a clean, ergonomic, runtime-agnostic rewrite on top of a Sans-I/O core; as of v0.20.0-rc.1 it ships with Tokio and smol runtime backends, with async-std and embassy on the roadmap.

Architecture:

  • rtc: Sans-I/O protocol core with complete WebRTC stack (95%+ W3C API
compliance)
  • webrtc (this crate): a thin async layer over rtc:
- PeerConnection โ€” the user-facing async API handle; all operations (create offers/answers, add tracks, create data channels) are async - PeerConnectionDriver โ€” an internal background event loop, spawned automatically, that owns the sockets, drives the Sans-I/O rtc core, handles timeouts, and dispatches events - Runtime โ€” a trait abstracting timers, task spawning, and sockets, so the crate is runtime-agnostic

๐Ÿ“– Learn more: Read our architecture blog post for design details and roadmap.

๐Ÿšจ v0.17.x โ†’ v0.20.0: the Sans-I/O rewrite (Release Candidate)

v0.20.0-rc.1 is the first release candidate of the new Sans-I/O, runtime-agnostic architecture. It supersedes the Tokio-coupled v0.17.x line, which is now in bug-fix-only maintenance.

Current Status

  • v0.17.x: Receives bug fixes only (no new features). The mature choice for Tokio-based production
applications today.
  • v0.20.0-rc.1 (master): The new architecture, published as a pre-release. As a release candidate, no further API
changes are expected unless critical issues are found (see Semantic Versioning). Recommended for early adopters and new projects that want the runtime-agnostic, Sans-I/O design.

What v0.20.0 delivers

The rewrite resolves the core pain points of v0.17.x โ€” callback hell and Arc explosion, resource leaks in callbacks, and tight Tokio coupling:

โœ… Runtime independence

  • Runtime-agnostic via a Quinn-style Runtime abstraction (timers, task spawning, sockets)
  • Feature flags: runtime-tokio (default) and runtime-smol; additional runtimes (async-std, embassy) are on
the roadmap behind the same abstraction

โœ… Clean event handling

  • Trait-based event handlers using native async fn in trait
  • No more callback Arc cloning or Box::new(move |...| Box::pin(async move { ... }))
  • Centralized state management with &mut self
โœ… Sans-I/O foundation
  • Protocol logic completely separate from I/O (via the rtc core)
  • Deterministic testing without real network I/O
  • A thin async driver (PeerConnection handle + background PeerConnectionDriver) over the core

How to Provide Feedback

We welcome your input while v0.20.0 stabilizes:

Production today: use the v0.17.x branch. Early adopters / new projects: try v0.20.0-rc.1 and report issues!

Building and Testing

# Update rtc submodule first
git submodule update --init --recursive

Build the library

cargo build

Run tests

cargo test

Build documentation

cargo doc --open

Run examples

cargo run --example data-channels

Semantic Versioning

This project follows Semantic Versioning:

  • Patch (0.x.Y): Bug fixes and internal improvements with no public API changes.
  • Minor (0.X.0): Backwards-compatible additions or deprecations to the public API.
  • Major (X.0.0): Breaking changes to the public API.
While the version is 0.x, the minor version acts as the major โ€” i.e., a minor bump may include breaking changes. Once 1.0.0 is released, full semver stability guarantees apply.

Pre-release versions are published with the following suffixes, in order of increasing stability:

  • -alpha.N: Early preview. API is unstable and may change significantly.
  • -beta.N: Feature-complete for the release. API may still have minor changes.
  • -rc.N: Release candidate. No further API changes are expected unless critical issues are found.
For example: 1.0.0-alpha.1 โ†’ 1.0.0-beta.1 โ†’ 1.0.0-rc.1 โ†’ 1.0.0.

Open Source License

Dual licensing under both MIT and Apache-2.0 is the currently accepted standard by the Rust language community and has been used for both the compiler and many public libraries since ( see ). In order to match the community standards, webrtc-rs is using the dual MIT+Apache-2.0 license.

Contributing

Contributors or Pull Requests are Welcome!!!

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท webrtc-rs/webrtc ยท Updated daily from GitHub