This demo uses (slightly patched) code from official quad-net example.
Tested with Rust 1.82.0, quad-net commit 31796d4ed.
- Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.
cdinto the folder of this example:
cd browser-quad-net- Clone the quad-net repo:
git clone --depth=1 https://github.com/not-fl3/quad-net.gitcdinto the cloned repo:
cd quad-net- Patch the provided example to make a HTTP request to remote website:
sed -i.bak 's|http://127.0.0.1:4000/|https://httpbin.org/anything|' examples/http_request.rs
sed -i.bak 's|client.wasm|http_request.wasm|' examples/web/index.html- Compile the example:
cargo build --example http_request --target wasm32-unknown-unknown --release- Copy the built WASM file to example's
webfolder:
cp target/wasm32-unknown-unknown/release/examples/http_request.wasm examples/web/- Copy the demo's file into current folder:
cp ../index.html ./- Run simple HTTP server to temporarily publish project to Web:
python3 -m http.serverCodespace will show you "Open in Browser" button. Just click that button or obtain web address from "Forwarded Ports" tab.
- As HTML, JS files, and a 450k-sized WASM file are loaded into browser, press a "HTTP Request" button and refer to browser developer console to see the results.
Perform your own experiments if desired.