Skip to main content

Crate iroh_webrtc_transport

Crate iroh_webrtc_transport 

Source
Expand description

WebRTC-backed custom transport primitives for Iroh.

This crate provides the reusable Rust pieces for establishing a direct WebRTC RTCDataChannel path and promoting that path into an Iroh custom transport session. Application protocols, demos, and UI state live outside the crate.

§Start Here

Most code should import one of the grouped public modules:

  • config: STUN, frame, and queue tuning.
  • browser: browser Wasm node facade.
  • native: native/server WebRTC session backend.
  • transport: Iroh custom transport integration.
  • facade: target-neutral facade configuration and dial options.

§Native/server shape

use iroh_webrtc_transport::{
    config::WebRtcTransportConfig,
    transport::{WebRtcTransport, configure_endpoint},
};

let transport = WebRtcTransport::new(WebRtcTransportConfig::default());
let hub = transport.session_hub();
let builder = configure_endpoint(builder, transport);
builder

With the native feature enabled, use native::NativeWebRtcSession to answer or initiate the WebRTC PeerConnection and attach the resulting DataChannel to the SessionHub.

§Browser shape

Browser applications should use the browser BrowserWebRtcNode facade. The facade owns Iroh/Wasm endpoint state and browser WebRTC objects in the same main-thread runtime.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use facade::NativeWebRtcIrohNode;
pub use facade::WebRtcDialOptions;
pub use facade::WebRtcNodeConfig;

Modules§

browser
Browser/wasm entry points.
config
Configuration types for the WebRTC custom transport.
error
Error and result types used by the transport, facades, and session helpers. Error types for WebRTC transport setup, framing, and packet routing.
facade
Target-neutral application facade contracts.
native
Native/server WebRTC entry points.
transport
Iroh custom transport integration for WebRTC-backed packet I/O. Iroh custom transport integration for WebRTC-backed packet delivery.

Macros§

browser_app
Export a browser application entry point from an application Wasm module.