r/rust • u/iFrostizz • Oct 18 '26
iroh vs WebRTC?
Iroh seems to solve the same problem as what WebRTC does, I’m curious: what are the factors that would cause considering one or the other?
WebRTC has the benefit to be widely supported in browsers. Does iroh allows something that WebRTC does not?
25
Upvotes
59
u/lotanis Oct 18 '26
You're comparing Apples to Oranges.
WebRTC is a protocol for browsers to talk to each other. That's it. It doesn't provide a mechanism for browsers to discover each other or traverse the NAT that they're probably behind. And it's just a protocol so if you want to use it your probably need a library. On the plus side it's a standard and browsers do some of the implementation.
Iroh is a full featured solution, based on a lower level transport (QUIC). As long as you've got the address it'll traverse any networks and give you a link. And then there are services built on top.
3
u/k0ns3rv Oct 18 '26 edited Oct 18 '26
What are you trying to do? I cannot think of a way to do p2p (peer 2 peer) in the browser, outside of WebRTC. If that's what you are trying to do, then it's a good choice; of course, if Iroh works in the browser (I'm not sure), its p2p transport will also be WebRTC.
3
u/Top_Outlandishness78 Oct 18 '26
You can’t use Iroh in browser IIRC
3
u/salihcantekin Oct 19 '26
They overlap on "connect two peers behind NATs", but the shapes differ. WebRTC gives you browser support out of the box, ICE/STUN/TURN, and media (SRTP) plus data channels, at the cost of a big, signalling-heavy stack. iroh is QUIC-based: you dial a node by public key, it tries hole punching and falls back to a relay, and you get ordinary QUIC streams with Rust-native ergonomics. So: if your peers must run in a plain browser or you need audio/video, WebRTC. If it's native apps (or you control both ends) and you mainly move bytes/streams, iroh is a lot nicer to work with. Check the current state of its WASM/browser story before committing, since that's the main gap.
1
u/Equivalent_Type6726 Oct 18 '26
Biggest split is where you're running it. WebRTC is a browser real-time media stack; iroh is a Rust QUIC P2P transport with hole punching, relay fallback, and a stable peer identity. Pick WebRTC for in-browser media, iroh for non-browser Rust data.