Async wrapper API for browser provided WebRTC API.
```rust use asyncdatachannelwasm::{Message, PeerConnection, PeerId, RtcConfig}; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, sync::mpsc, };
let iceservers = vec!["stun:stun.l.google.com:19302"]; let (txsigoutbound, mut rxsigoutbound) = mpsc::channel(32); let (txsiginbound, rxsiginbound) = mpsc::channel(32); let listener = PeerConnection::new(iceservers, (txsigoutbound, rxsiginbound))?;
// TODO: Wire up tx_sig_inbound
and rx_sig_outbound
to a signalling
// mechanism.
let mut dc = listener.dial("Hangout").await?; dc.write(b"Hello").await?;
let mut buf = vec![0; 32]; let n = dc.read(&mut buf).await?; assert_eq!(b"World", &buf[..n]); ```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.