webrtc-php icon indicating copy to clipboard operation
webrtc-php copied to clipboard

Can WebRTC Be Many To Many?

Open volomike opened this issue 4 years ago • 5 comments

I'm a seasoned PHP coder but am very new to WebRTC. Can WebRTC be many to many? For instance, 5 friends connect to a web page and can do text chat (not concerned about video or audio) with each other, peer-to-peer, and the only reason the central server is used is to get the handshake and to download the code into their browser. Is that possible?

volomike avatar Jul 03 '20 02:07 volomike

Hi Mike,

WebRTC can be many to many yes. I do not know how many though. My experiences with many to many are not that great, I noticed that there is zero chance of knowing that everybody can see everybody. I noticed that using jit.si . It is great, but with more than 5 people it can not hold up. That is why things like Zoom are so popular: they really manage to make it stable due to having all trafic go through one central place.

Hope this helps, best,

Niels Gorisse https://www.verbindendecommunicatie.com - Certified Trainer with the Center for Nonviolent Communication cnvc.orghttps://cnvc.org https://www.strohplatz.com


Van: Mike McKee [email protected] Verzonden: vrijdag 3 juli 2020 04:01 Aan: nielsbaloe/webrtc-php [email protected] CC: Subscribed [email protected] Onderwerp: [nielsbaloe/webrtc-php] Can WebRTC Be Many To Many? (#13)

I'm a seasoned PHP coder but am very new to WebRTC. Can WebRTC be many to many? For instance, 5 friends connect to a web page and can do text chat (not concerned about video or audio) with each other, peer-to-peer, and the only reason the central server is used is to get the handshake and to download the code into their browser. Is that possible?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nielsbaloe/webrtc-php/issues/13, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB7ALAW6HGPKMNOG6BPCUBLRZU3YBANCNFSM4OPMQPKQ.

nielsbaloe avatar Jul 03 '20 07:07 nielsbaloe

Yes WebRTC can do many-to-many, but like Niels says, harder to code. Do you really need the R(ealtime) from WebRTC? If not (a chat isn't Real time like video is) then Server Sent Events (SSE) and a fetch for communicating TO the Server is a lot simpler. The Server PHP code is 6 lines of code, the javascript code less

EventSource API is now supported in all modern browsers

  • https://developer.mozilla.org/en-US/docs/Web/API/EventSource
  • https://www.smashingmagazine.com/2018/02/sse-websockets-data-flow-http2/
  • https://www.html5rocks.com/en/tutorials/eventsource/basics/

Many-to-many requires maintaining state on the Server, With seasoned PHP skills, a chat can be a plain TXT file from which SSE serves the last new lines

Leaving or joining a chat is a whole lot easier, compared to WebRTC, because there is no peer-to-peer If you join a chat you get (fetch) the whole TXT file

Danny-Engelman avatar Jul 03 '20 10:07 Danny-Engelman

Interesting, guys. Thanks for much for the response. So, basically what you're saying is, even if we could do peer-to-peer, many-to-many chat, it wouldn't be desirable because there's no proper state management. I mean, people login to a chat and want to see the last 100 messages or so of where the discussion is. We can't do that without state management. I was interested in the P2P aspect for security reasons. However, it appears that one would be better off to just use https to a server over ordinary AJAX, not use WebRTC for this, and then use a stack system in PHP (storing only 100 messages at a time, popping on new to the bottom, popping off old from the top) on the server for the state management.

volomike avatar Jul 03 '20 17:07 volomike

And what about one-to-many?

NoBodyButMe avatar Oct 17 '20 09:10 NoBodyButMe

Yes it can.

many to many is how jit.si works.

One to many is possible but very inefficient, you are better off using youtube or facebook or another streaming service.

Met vriendelijke groet,

Niels Gorisse https://www.verbindendecommunicatie.com - Certified Trainer with the Center for Nonviolent Communication cnvc.orghttps://cnvc.org https://www.strohplatz.com


Van: NoBody [email protected] Verzonden: zaterdag 17 oktober 2020 11:15 Aan: nielsbaloe/webrtc-php [email protected] CC: nielsbaloe [email protected]; Comment [email protected] Onderwerp: Re: [nielsbaloe/webrtc-php] Can WebRTC Be Many To Many? (#13)

And what about one-to-many?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/nielsbaloe/webrtc-php/issues/13#issuecomment-710781630, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB7ALARGKS6YD6RJWSDKK23SLFODNANCNFSM4OPMQPKQ.

nielsbaloe avatar Oct 17 '20 12:10 nielsbaloe