rtc
Sans-IO WebRTC implementation in Rust
A sans I/O WebRTC implementation written in Rust
RTC is a pure Rust library that implements the WebRTC protocol stack using a sans-I/O design, giving developers full control over networking and async runtime integration.
Why the sans I/O design matters
RTC separates protocol logic from I/O operations. The library handles the WebRTC protocol while you control all network reads and writes, feeding it data and reading what it wants to send. This makes the code runtime independent: it works with tokio, async-std, smol, or even blocking I/O. Because protocol logic never touches the network directly, it can be tested without real sockets, and it slots into existing networking code. The core event loop exposes six methods: poll_write for outgoing packets, poll_event for state changes, poll_read for application messages, poll_timeout for timer deadlines, handle_read to feed incoming packets, and handle_timeout for expired timers.
Protocol coverage
The library implements the main WebRTC building blocks. It supports ICE with STUN and TURN for NAT traversal, DTLS for encrypting media and data, SCTP for reliable data channels, and RTP and RTCP for real time media transport and control. SDP offer and answer negotiation, media tracks for audio and video, trickle ICE for progressive candidate gathering, and simulcast plus scalable video coding are all listed as supported. RTC is built from composable crates, each handling one protocol: media, interceptor, datachannel, rtp, rtcp, srtp, sctp, dtls, crypto, mdns, stun, turn, ice, sdp, and shared.
Using the library
Developers build and test with standard Cargo commands such as cargo build and cargo test, and the repository ships example programs like data-channels-offer-answer, reflect, save-to-disk-vpx, play-from-disk-vpx, simulcast, broadcast, and stats. Because WebRTC needs an external signaling channel, the docs show exchanging offers and answers over WebSocket or HTTP while RTC manages the peer connection itself. The implementation follows the W3C WebRTC 1.0 spec and related RFCs for ICE, DTLS, SCTP, and RTP. It is released under the MIT license or the Apache 2.0 license, at the user's option.
Editorial conclusion
RTC is dual licensed under MIT or Apache 2.0 and follows semantic versioning, where the minor version acts as the major while the release is still in the 0.x range.
Community notes