Host and members
The network is a star around the lobby host. The host’s game reaches every member; a member’s game reaches the host only.
A member’s
Peer::All reaches the host alone. To relay a member’s message to the others, have the host send it on. There is no host migration: when the host leaves, the lobby and the network close.
Two channels
A larger message is refused with
invalid_argument before it leaves your game.
Events
poll_events() reads memory only. Call it every frame.
route is Direct or Relayed. A relayed link adds the relay’s round trip, so show it to the player when latency matters.
Refusing the relay
Some players do not want their traffic to go through a relay. Open withallow_relay: false:
RelayRefused instead of a link. Either side refusing is enough.
Receiving
receive() reads memory only. Drain it every frame. Past 64 MiB waiting, new unreliable messages are dropped, and a reliable one closes the network with the reason receive_overflow.
Errors
Full table and what to do about each: Errors.