Broadcast or peer discovery with PeerJS

Viewed 5891

I am evaluating PeerJS in order to implement a simple two-player online game. It seems that once I transfer the id of one player’s connection to the other, they can open a channel via PeerJS and are good to go.

But if two players want to play that do not know each other, what is the most elegant way to make a match there? Is there a way to ask the PeerJS broker for a list of all connected clients, possibly with some metadata (such as „status:wants-to-play”) attached? Or is ther ea way to broadcast to all clients?

2 Answers
Related