rtc-io / rtc-switchboard

Node server side in memory signaller for rtc.io components
http://www.rtc.io/modules.html
57 stars 36 forks source link

Should the switchboard advise a signaller how many peers are in the current scope? #9

Closed DamonOehlman closed 10 years ago

DamonOehlman commented 10 years ago

When joining a server one of the first things you do if you are using the signaller is to send an /announce message. This is sent to other connected peers within your current scope (room if you have announced in a room) or server if not.

To determine whether or not you have any peers around you, you currently have to wait until connected peers send you a targeted /announce message telling you about them.

The difficulty is, that at this stage you have no idea on whether to expect these wait for messages, etc. In most cases, this does not cause a problem, but in my experimentation with creating a mesh demo you need to take different action if you are the first party in a room vs another party joining. As it stands, you have no way of telling that you are the first party in the room.

A potential solution to this would be to extend the switchboard to send something like a /roominfo message to the peer that has just announced itself containing room metadata.

Applications requiring this kind of information could then listen for the roominfo event and make determination based on this. For instance, rtc-mesh would wait for the event to determine whether it is ready immediately if the first or whether it should wait for peer data to sync before providing access.