3 ms·
How does UDP work for broadcasting audio? I can understand UDP from a speaker's phone to a CH server, but how would UDP packets be sent to thousands of listener
by sudhirj 6y ago
How does UDP work for broadcasting audio? I can understand UDP from a speaker's phone to a CH server, but how would UDP packets be sent to thousands of listeners, many of them hidden in NATs?
What would be a better architecture? If I had to build this I'm thinking a fleet of Phoenix/Erlang servers accepting websocket connections and distributed-ly broadcasting each packet over them, think there's some WebRTC tools for this.
Any better ideas? Go with memberlist UDP transmission maybe?
- saurik 6y agoAny serious audio transmission is going to be done over UDP as otherwise you get ridiculous head of line blocking issues where a single lost data packet can cause a blip in the audio at least as long as a full round trip. NAT--even broken symmetric NAT--is not an issue, as the client is establishing the channel to a fixed, public endpoint.
- sudhirj 6y agoFor sending the audio from the speaker to Clubhouse, sure. What about the broadcast to all the listeners? Here the server is sending UDP packets to thousands of clients? Not sure how NAT works with UDP incoming into the NAT - isn't UDP connection-less and there's no indication from the server side what the internal network layout is?
- spicyramen 6y agoYou use ICE/StUN servers to solve this.
- the-dude 6y agoThe trick to punching UDP through NAT is to make the client do an outbound transmission first. Now your NAT is keeping an eye on this port and will forward incoming packages to said client. And what the sibling says : all solved with STUN/TURN/ICE. This is decades old tech.