Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

WASM Chat

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.

Prerequisites

  • Docker (for serving static files)
  • The NetBird setup key must allow the peers' group

Build & Run

cd wasm-chat
make build
docker compose up

Open http://localhost:3000 in a browser.

Usage

  1. Enter your NetBird setup key and a nickname
  2. Click Connect. the browser joins the NetBird network and starts listening on the tunnel
  3. Type a message and press Enter. it gets sent to all connected peers via HTTP over the WireGuard tunnel
  4. Open another browser tab (or another machine) with the same setup key to chat

How it works

  1. A custom Go WASM binary (main.go) wraps the NetBird embedded client
  2. On connect, the WASM client calls ListenTCP to accept incoming HTTP on the tunnel
  3. sendMessage discovers peers via Status() and POSTs the message to each peer's NetBird IP
  4. Incoming messages are stored in-memory and polled by the JS frontend
  5. Static files are served by Caddy via Docker. all chat traffic flows through the NetBird mesh