Peer-to-peer chat over the NetBird network, running entirely in the browser via WebAssembly. Each browser tab joins the NetBird mesh as a peer, listens for incoming messages on the WireGuard tunnel, and broadcasts messages to all connected peers. no central server needed for chat traffic.
- Docker (for serving static files)
- The NetBird setup key must allow the peers' group
cd wasm-chat
make build
docker compose upOpen http://localhost:3000 in a browser.
- Enter your NetBird setup key and a nickname
- Click Connect. the browser joins the NetBird network and starts listening on the tunnel
- Type a message and press Enter. it gets sent to all connected peers via HTTP over the WireGuard tunnel
- Open another browser tab (or another machine) with the same setup key to chat
- A custom Go WASM binary (
main.go) wraps the NetBird embedded client - On connect, the WASM client calls
ListenTCPto accept incoming HTTP on the tunnel sendMessagediscovers peers viaStatus()and POSTs the message to each peer's NetBird IP- Incoming messages are stored in-memory and polled by the JS frontend
- Static files are served by Caddy via Docker. all chat traffic flows through the NetBird mesh