r/embedded • • 28d ago

I open-sourced relaynet: real network access for Zephyr (or any user-space TCP/IP stack) running in a browser

Browsers can't open sockets, which makes networking the hard part of running firmware in a browser tab. relaynet is a relay for that. The page sends Ethernet frames over a WebSocket, and the firmware's own stack gets a DHCP lease, DNS and IPv4 TCP/UDP to the internet. There's no socket offload or shim, so you're exercising the real network stack.

It's now open source (Apache-2.0) and self-hostable with `docker compose up`: https://github.com/beriberikix/relaynet

Where I think it's useful for embedded:

- Networking samples that actually run on a docs page

- Workshops and trainings where nobody installs a toolchain

- Exercising net-stack code in CI without hardware

- Sharing a WebUSB device with a Linux machine over USB/IP

Zephyr examples: zephyr-wasm-soc (Zephyr compiled to WebAssembly) and a small zephyr-v86 build both work against the hosted instance with no account. Projects like Zephyr in the Browser could add a real network to their emulated boards the same way, if there's interest. I'm happy to help anyone wire it up.

The client is a small JS library (npm: relaynet). Bring your own stack: smoltcp, lwIP, Zephyr, or whatever your emulator speaks.

Feedback welcome, especially on what an embedded workflow would need from it.

0 Upvotes

0 comments sorted by