2
votes

It would be lot's of fun if it were possible to make a text chat, where the room/channel where the URL, like domain.com/myroom. It would also be awesome if it were p2p and encrypted. So I though - WebRTC datachannels, yeay!

It does seem to require a server that controls the connections though, is this correct? Is there any workarounds? Backwards compability is not a concern here. I also wonder if it would be a problem with multiple participant. WebRTC seems to be a two person thing.

Sorry if it seems that I should Google the answer, but I've really tried. There is info, but I'm confused... lots of outdated info and misunderstandings.

1
this would be a good place to start, webrtc-experiment.com/docs/webrtc-for-newbies.html ... the data is quite up-to-data and accurate, and yes, server is needed primarily for signalling purpose, and in some cases, an additional STUN/ TURN server is required.mido

1 Answers

1
votes

For initiate a WebRTC call, your first client have to send to your second one a SDP (offer). It includes all the mandatory informations about the communication (https://webrtchacks.com/sdp-anatomy/). The second client have to do the same (SDP answer). Moreover, they have to exchange their ICE candidates (IP address, port, and transport protocol). After that, your clients should be able to communicate in P2P with encrypted media (Datachannel).

But for relaying all those info from a browser to the other, the easiest way to do it, will be with a server. AFAIK, there isn't a simple solutions with browsers to do it without server. Note that, sometimes, P2P wont work (proxies, firewall, restrictive NATs...), and you may use a TURN server for relaying your media (but it's still encrypted).

A peerconnection defines a P2P communication (2 clients). However, in your webpage you could create several peerconnection.