Skip to main content

Crate webrtc_direct_client

Crate webrtc_direct_client 

Source
Expand description

WebRTC Direct client for the browser (WASM).

Connects to a [webrtc-direct-server] using the server’s socket address and DTLS fingerprint, no signaling server required.

§Usage

use webrtc_direct_client::{WebRtcClient, FramedClient, Fingerprint};
use std::net::SocketAddr;

let addr: SocketAddr = ([127, 0, 0, 1], 3478).into();
let fp = Fingerprint::from_hex(hex_string);

let raw = WebRtcClient::connect(addr, fp).await.unwrap();
let client = FramedClient::new(raw);

client.send(b"hello").unwrap();
let response = client.recv().await.unwrap();

WebRtcClient gives raw DataChannel access. FramedClient wraps it with length-prefixed LZ4-compressed framing, matching the server’s [FramedReader]/[FramedWriter].

Re-exports§

pub use client::WebRtcClient;
pub use error::WebRtcError;
pub use framed::FramedClient;

Modules§

client
error
framed
sdp

Structs§

Fingerprint
Ufrag