Web And WASM
The WASM SDK lives in crates/openipc-web and is built with
wasm-bindgen.
npm --prefix crates/openipc-web run build
The generated package is written to:
crates/openipc-web/pkg
That package contains the compiled .wasm, JavaScript glue, TypeScript
definitions, npm package metadata, README, and MIT license. The generated output
is ignored by git and should be recreated in CI when publishing.
Browser Flow
- React calls
navigator.usb.requestDevicefrom a user gesture. - The browser returns a granted
UsbDevice. - React passes that object to
WebUsbRealtekDevice.fromWebUsbDevice. - Rust/WASM uses
nusbto claim interface 0 and discover endpoints. - The shared Rust Realtek HAL initializes monitor mode and channel settings.
- Bulk-IN transfer bytes feed the same Rust receiver pipeline used by native.
- Rust/WASM returns structured video frames, link metrics, and debug metrics.
- React sends frames to WebCodecs and renders the decoded output.
WebCodecs Boundary
Rust extracts H.264/H.265 Annex-B frames and returns frame metadata. JavaScript
owns WebCodecs because the browser API is naturally tied to rendering,
VideoFrame lifetimes, canvas capture, and user-agent codec support.
This keeps the heavy packet/protocol path in Rust while avoiding unnecessary copies of decoded video surfaces back into WASM.
See WASM SDK Usage for a complete WebUSB and WebCodecs code example.