Question

Signaling is not addressed by WebRTC (even if we do have JSEP as a starting point), but from what I understand, it works that way :

  1. client tells the server it's available at X
  2. server holds that information and maps it to an identifier
  3. other client comes and sends an identifier to get connection information from the first client
  4. other client uses it to create it's one connection information and sends it to the server
  5. server sends this to first client
  6. both client can now talk

This is all nice and well, but what happends if a 3rd client arrives ?

You have to redo the whole things. Which suppose the first two clients are STILL connected to the server, waiting for a 3rd client to signal itself, and start the exchanging process again so they can get the 3rd client connection information.

So does it mean you are required to have to sort of permanent link to the server for each client (long polling, websocket, etc) ? If yes, is there a way to do that efficiently ?

Cause I don't see the point of having webRTC if I have to setup nodejs or tornado and make it scales to the number of my users. It doesn't sound very p2pish to me.

Please tell me I missed something.

Was it helpful?

Solution

What about a chat system? Do you really need to keep a permanent link to the server for each client? Of course, because otherwise you have no way of keeping track of a user's status. This "permanent" link can be done different ways: you mentioned WebSocket and long polling, but simple periodic XHR polling works too (although this will affect the UX, depending on the interval).

So view it like a chat system, except that the media stream is P2P for reduced latency. Once a P2P WebRTC connection is established, the server may die and, of course, the P2P connection will be kept between the two clients. What I mean is: both users may always block your server once the P2P connection is established and still be connected together in the wild Internets.

Understand me well: once the P2P connection is established, your server will not be doing any more WebRTC signalling. The connection is only needed to keep track of the statuses.

So it depends on your application. If you want to keep the statuses of users and make them visible to others, then you're in the same situation as a chat system: you need to keep a certain link, somehow, to make sure their statuses are synced. Otherwise, your server exists to connect them together and is not needed afterwards. An example of the latter situation is: a user goes to a webpage, the webpage provides him with a new room URL, the user shares this URL to another peer by another mean, the other peer joins the room, server connects them together (manages WebRTC signalling) and then forgets them. They are now connected until one of them breaks the link. Just like this reference app.

Instead of a central server keeping one connection per client, a mesh network could also be considered, albeit difficult to implement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top