5 ms·
The fact is that you can't easily do the last part without a central server. There might be some public or semi-public servers for this kind of thing available
by Klathmon 8y ago
The fact is that you can't easily do the last part without a central server.
There might be some public or semi-public servers for this kind of thing available somewhere, or the alternative that I played with a few years ago was to compress and base64 encode the connection information into a string, and allow users to share the link with friends via whatever method they want, and that can then be expanded client side and used to establish the connection. (Or something like qr codes I've also seen used)
Sadly I never finished that project, so I don't really have any code to show you, but in theory it should work okay.
- sdegutis 8y agoI mean if everyone already has a way to contact their friends (discord) and say "hey let's play this game together", sharing that link does away with the need for a coordination server. But there's still the need for at least a server, even if it's just one of the clients that knows how to take charge (like Minecraft).
- Klathmon 8y agoYeah, I skipped over a lot of the details, but you would need someone to choose to be a "host" (at least in terms of a "host" for the connection signaling stuff), but you can also implicitly make it the person who created the link safely.
- derefr 8y agoIf everybody is behind NATs (without uPnP privileges), nobody can be the "host" for connection-signalling purposes.
- Klathmon 8y agoThere are public ICE/STUN servers that can facilitate NAT-punching, google even hosts one. But that's not the aspect that I thought the root comment was talking about, but more the aspect of "A is hosting a room called 'stuff', and B and C want to browse the list of rooms and connect to it".
- ObsoleteNerd 8y agoThe link could just be encoded information that gives the hosts details for everyone else to connect to.
- kaoD 8y ago> base64 encode the connection information into a string Doesn't work anymore. Firefox times out the answer offer after very few seconds, which makes sharing the answer offer asynchronously impractical, which effectively killed serverless WebRTC and in turn killed any interest I had on it (for my side projects I mostly do serverless web apps, as in real serverless, not lambda functions).
- Klathmon 8y agoOuch! That really sucks... Is there a ticket number or blog post or something I can research to learn a bit more about the reasoning behind this change with them?
- kaoD 8y agoNo ticket that I know of. It's mentioned in https://blog.mozilla.org/webrtc/ice-disconnected-not/ https://blog.mozilla.org/webrtc/ice-disconnected-not/ > So every 5 seconds Firefox (version >= 49) sends another binding request no matter if the ICE transport is in use or not, and it expects the other side to reply with a binding response. If it hasn’t received a binding response for 6 consecutive binding requests, in other words no reply within the last 30 seconds, it will give up and mark the transport as failed. This results in switching the ICE connection state to ‘failed‘ and stop sending any packets over that transport.
- api 8y agoZero-config peer to peer is basically impossible without central servers or some large populated list of long-term seed nodes which are basically central servers. The central servers don't have to do much, but they need to exist so new nodes on random IPs can find each other. The Internet has no native service discovery bus.
- hobo_mark 8y agoCould I avoid requiring a central server, and still use webrtc, if the two peers I want to connect are in the same lan?
- api 8y agoI think this is possible, but I'm not sure about the details. I think their IPs need to be obtained somehow though. I don't think you can use things like mDNS from web pages without a plugin.
- singularity2001 8y agowould ip guessing work? 192.168.. … ?
- api 8y agoIt would flood the network with probes and take quite a while.
- mcdevilkiller 8y agoMaybe embedding nmap with the electron app to search for active bodes, then probeing. Requires some C or C++ knowledge though.
- singularity2001 8y agocan't electron js do local pings?
- DINKDINK 8y ago>The fact is that you can't easily do the last part without a central server. Looks up DHT use.
- Klathmon 8y agoDHT is a fantastic system, but it's not easy by any means, and it still needs some "important" nodes to help bootstrap the system.