seemk / WebUDP

Minimal WebRTC datachannel server
MIT License
264 stars 32 forks source link

WebUDP don't need a stun server and a signaling server? #6

Closed lxlenovostar closed 6 years ago

lxlenovostar commented 6 years ago

I read the examples/EchoExamples.cpp, I can't find query a stun server and a signaling server. If we want to P2P between WebUDP and chrome(js) in a network behind NAT, we should use a stun server and a signaing server. I think WebUDP will install on the server and have a public IP, so we don't need stun server and signaling server. This is right?

Thank you.

seemk commented 6 years ago

Yes, this is right, you don't need need external signalling or STUN. WebUDP is meant to have a public IP and it has built-in signalling and STUN. The default Linux C++ implementation (epoll) uses HTTP for signalling.

lxlenovostar commented 6 years ago

Do you have a plan which implement WebUDP can used in a network behind NAT? If WebUDP can achieve this function, a P2P network can build between WebUDP and chrome. In addition, we can use WebUDP on Embedded equipment and Mobile devices.

Thank you.

seemk commented 6 years ago

I think it is possible to run WebUDP behind a NAT, but you will need another coordinator server with a public address to do the UDP hole punching via STUN or some other method. Basically: 1) WebUDP registers with a coordinator server, the coordinator now knows WebUDP's public IP, port. 2) Browser clients get WebUDP's server address from the coordinator. 3) Browser clients initiate a connection to WebUDP

Keep in mind that the moment there is no client mode for WebUDP, it can't initiate a connection itself to other servers or browsers, but I've been thinking of adding that feature.

If you want to run it on mobile devices or embedded equipment, there's also an option to write your own host implementation using libWu (Wu.h). The default Linux C++ host uses HTTP over a TCP socket to exchange SDPs, but it is very much possible to use UDP for the SDP exchange as well (via a coordinator server, not directly from the browser), so you would only need to open an UDP port on the device.

lxlenovostar commented 6 years ago

Do you have a TODO list? In this case, others can participate.

Thank you.

seemk commented 6 years ago

It does now :) I added 2 issues with the "enhancement" label, these are the ones that have been in the back of my mind, but not important for myself.

8

9