Closed DAOCUONG closed 1 month ago
Currently iroh
is not compatible with wasm
building. There are multiple dependencies (like quinn
) and internal code that need to first change to support it.
Quinn recommends WebTransport for browser WebAssembly environment.
Quinn recommends WebTransport for browser WebAssembly environment.
Last comment in that thread says:
There are now implementations of WebTransport that use Quinn, e.g. https://github.com/kixelated/webtransport-rs. Quinn is a QUIC implementation, and WebTransport is built on top of (HTTP/3 which is built on top of) QUIC.
And https://developer.chrome.com/docs/capabilities/web-apis/webtransport indicates that all major browsers other than Safari support it now.
So ... how more or less one would go about it?
Does WebTransport
allow a browser side be a server part of the WebTransport
protocol? If no, then how iroh
would work in the browser environment? As I know iroh
node is a "client" and a "server" at the same time. I suppose it will work only as a client. In theory WebRTC
may help, but in that case non-browser iroh
node should support 2 communication protocols at the same time QUIC
and WebRTC
, that is problematic.
We have a plan for getting iroh to
But for the first iteration - that will require that the browser node is permanently connected to an iroh relay node & forwarding traffic over that.
IIUC (I'm fairly new to the project), @Voronar is spot on. Our current plan is websockets + relay, and later potentially trying WebRTC data channels for peer-to-peer connections. Some of us have looked at WebTransport and found that it probably won't work.
As I know iroh node is a "client" and a "server" at the same time
How does webtorrent works? Is it not client and server at the same time?
Also wasm doesn't mean only for browser environment, Iroh need to also support edge serverless computing like wasmedge, spin or everywhere computer
work in the browser via wasm_bindgen.
We did this with rust-libp2p
and it works pretty well.
I'm here because I stumbled upon Willow
which is apparently partially implemented in iroh
which is cool.
Ideally I'd use the iroh
willow portions but most of my current connecting and networking is built in libp2p
over webRTC
though, as I want the ability to connect the browser to "the node", whatever the node shall be.
On the server side you might consider str0m for WebRTC as it's sans-io, though less mature than webrtc-rs it may be easier to work with in the long run.
One last random point that I'll note on wasm is that we will eventually be moving toward WebAssembly Component Model which uses wasm interface types (WIT) which is what spin and everywhere comp are built upon. It's still early (v0.2.0) but it might be worthwhile to look down the road at what Wasm is going to look like in a year or two and design around that.
Closing in favor of a unified issue: https://github.com/n0-computer/iroh/issues/2799
Try to run :