I want to understand how P2P server work. I'm trying to implement live video streaming in Android to server.
For further actions, you may consider blocking this person and/or reporting abuse
I want to understand how P2P server work. I'm trying to implement live video streaming in Android to server.
For further actions, you may consider blocking this person and/or reporting abuse
ANIRUDDHA ADAK -
Ben Halpern -
Ravin Rau -
Kiolk -
Top comments (3)
Hi! The funny thing is that with P2P there isn't much of a server. The primary purpose a cloud server is used for is to negotiate the initial connections between peers (the people on the call). After that, all communication flows directly between the peers.
I work at Daily. We build video APIs that help developers add video chat to their apps quickly. One of our cofounders wrote up a blog post that really clarified P2P calling for me [0].
I'd be curious to hear more about what you're building! Feel free to email me at
kimberlee@daily.co
if I can be of any help.[0] daily.co/blog/peer-to-peer-for-the...
Hey! Thanks for the insight!
The "negotiate initial connections" part I understood. But, the next part. How do the peers know about the other peers? So, in one of the peer, will there be a server running which another peer tries to do data transfer? This is one logic what I can think of. Or, is there any other concept behind this?
Also, thanks for the blog. I'll check that out as well.
So, like you say, the server sets up the initial connection.
If you've ever been assigned a roommate at a university, for example, it's a bit like that. The university gives you your future roommate's name and phone number and maybe a bit more information about the person. From there on out, though, you don't send messages back and forth through the university, you call the roommate directly without the university being involved.
That's exactly what happens in peer to peer. Once the server has allowed me into a call, it hands me the IP addresses of others already in the call and from there I can send out my audio and video streams to each of the IPs (peers) in the call as well as receive their audio/video back. If someone else joins after me, the server lets me and the others know and we start sending/receiving media directly with the new peer. And we know how to do this because we all (or rather, our browsers all) speak the same media language, WebRTC. So the server retains knowledge about the existence of the call and who is in it, and probably has some rules about who it allows into the call, but everything else is communicated directly between the peers, never going to the server.
Does that help? The WebRTC guides and docs have helped me, so sharing here in case useful too: webrtc.org/getting-started/overview