Sadly both WebRTC and WebSockets seem to have been designed in such a way that excludes pure peer-to-peer operation.
Sadly both WebRTC and WebSockets seem to have been designed in such a way that excludes pure peer-to-peer operation.
What do you mean by pure peer-to-peer operation?
The standards are carefully defined in a way that creates server dependency. WebSocket outright does not allow connections to other browsers directly. WebRTC does, but you are extremely limited in how you could do discovery. I think both are intentional.
WebRTC needs info about where to try to connect. It doesn’t specify the signaling method which is how you get that information and share it.
If you’re already on the same subnet, use mDNS.
If you’re on different subnets it requires some kind of way to share the subnet info.
If you’re on different networks behind NAT then scanning isn’t very helpful. You’d need to scan IPs and ports because NAT randomizes the outbound ports. That’s what STUN helps you figure out. Once you’ve got that info and you build the session description structure you can send that to the other party however you want.
Public, free STUN servers exist. And people use them for all kinds of WebRTC stuff.
Neither WebRTC nor WebSockets prevent pure P2P. It sounds like your bigger issue is with NAT. IPv6 isn’t going to fix it though since the IP space will be too large to scan for peers.
You misunderstood, knowing subnet is an option for discovery of nearby peers. If you know your subnet you can scan it in reasonable amount of time. Otherwise you'd have to scan the whole IPv4 space (or worse IPv6 space).
> WebRTC needs info about where to try to connect. It doesn’t specify the signaling method which is how you get that information and share it.
Yes.
> If you’re already on the same subnet, use mDNS.
You can't - you are in the browser.
> If you’re on different subnets it requires some kind of way to share the subnet info.
Yes, that's how connections are established with an intermediary signaling service. The p2p question is about possibility of establishing WebRTC connection without a signaling service that runs over something else and/or requires a centralized server.
I have been working on WebRTC a lot lately. If you have ideas on how you’d solve this issue I’d take a stab at implementing them.
I’ve built a demo that lets you get two systems connected by copying and pasting the session description information. No third party systems required. But you still need to get your clipboard data to someone else. Which usually means SMS, Apple Messages, etc.
If you are interested I would love to work together! Join the Pion slack and would love to brainstorm
You'd literally have to scan QR codes on both devices, but that's the only option I have in mind