Allocating, binding, and joining

Allocating, binding, and joining are three distinct concepts in the Relay connection flow.

Note: Binding, and other interactions done through a Relay server, are handled using a networking solution such as UTP or NGO. NGO is higher level and uses UTP under the hood.

Allocating

Allocating is when a host player tells the Allocations service about their intent to connect to a Relay server, and the Allocations service reserves slots on a Relay server. When the Allocations service reserves slots on a Relay server, it prepares the Relay server for players to bind (establish a network connection). The number of slots depends on the maximum number of connections specified in the allocation request.

Check out the following steps in the connection flow:

Binding

Binding is when the player establishes a connection with the Relay server that the Allocations service reserved for the player during the allocating process. After the player completes the binding process, the Relay server can discover the player’s IP address and exchange packets.

Note: The host player and joining players must bind to the Relay server before connecting to each other.

A BIND is a specific message sent via the Relay protocol from the game client to the Relay server to establish its connection to the Relay server.

Note: You typically send BIND messages after calling the allocate and join APIs, which retrieve the Relay server’s destination address for use with the BIND message.

Check out the following steps in the connection flow:

Joining

Joining is when a joining player joins the host player’s allocation on a Relay server. After the joining player completes the joining process, they can exchange messages with the host player. Allocating and joining are similar processes. The primary difference is that the join API response has the host connection data.

Note: A join is when a joining player (a non-host player) client joins the host client’s game session. Under the hood, it’s another allocate call to the Relay service.

Check out the following steps in the connection flow: