How Tube's server-client architecture works
mainTube implements a server-client architecture for peer-to-peer connectivity. One peer is designated as the server, while all other peers act as clients that connect to it.
The server's primary responsibility is relaying Godot's High-level Multiplayer RPCs between peers. Connectivity is established via WebRTC, which requires three components for the initial signaling phase:
- Signaling servers: Used to exchange connection initialization messages.
- STUN servers: Used to help peers determine their public addresses.
- TURN servers (optional): Used as relays if a direct peer-to-peer connection cannot be established (e.g., when both peers are behind a symmetric NAT).
Note: Tube attempts to use UPnP port mapping to open ports automatically when a TURN server is unavailable, but this is not supported on the Web platform.