Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
datachannel-rs
Rust wrappers for libdatachannel, a WebRTC Data Channels standalone implementation in C++.
Usage
This crate provides two traits that end user must implement, DataChannelHandler
and
PeerConnectionHandler
, which defined all callbacks for RtcPeerConnection
and
RtcDataChannel
structs respectively.
Aforementioned traits are defined as follows:
Note that all on_*
methods have a default no-operation implementation.
The main struct, RtcPeerconnection
, takes a RtcConfig
(which defines ICE servers)
and a instance of PeerConnectionHandler
.
Here is the basic workflow:
use ;
;
;
let ice_servers = vec!;
let conf = new;
let mut pc = new?;
let mut dc = pc.create_data_channel?;
// TODO: exchange `SessionDescription` and `IceCandidate` with remote peer
// TODO: wait for `dc` to be opened (should be signaled through `on_open`)
// ...
// Then send a message
dc.send?;
Complete implementation example can be found in the tests.
See also async-datachannel for an async-based implementation.
Cargo features
- log (default) Enables logging provided by the
log
crate (mutually exclusive with tracing). - tracing Enables logging provided by the
tracing
crate (mutally exclusive with log). - vendored Builds libdatachannel and its dependencies statically and bundles them in
the build (including
OpenSSL
). - media Enables media support through
libdatachannel
.
Building
Note that CMake
is required to compile libdatachannel through
datachannel-sys.
Apple macOS
You probably need to set the following environment variables if your build fails with an
OpenSSL
related error.
With the paths of your local OpenSSL
installation.
Ubuntu
Required dependencies:
# Needed to compile libdatachannel