WebRTC DataChannel Example

View full source code or view the compiled example online

This example creates 2 peer connections and 2 data channels in single browser tab. Send ping/pong between peer1.dc and peer2.dc.

Cargo.toml

The Cargo.toml enables features necessary to use WebRTC DataChannel and its negotiation.

{{#include ../../../examples/webrtc_datachannel/Cargo.toml}}

src/lib.rs

The Rust code connects WebRTC data channel.

{{#include ../../../examples/webrtc_datachannel/src/lib.rs}}