Skip to main content

Distributed Relay Manager


This section of the documentation is a work in progress and is subject to change.

Don't hesitate to ask questions or make requests via our Discord channel. We are here to assist you!

The Edgegap Distributed Relays benefit from our distributed cloud network, which includes hundreds of locations. This ensures that your players are always playing on the best available relay, thanks to our patented real-time telemetry decision technology.

Implementing relays can indeed be a complex task, which is why we have developed a solution that takes care of the technical aspects so you don't have to. Our solution simplifies the process of setting up and managing relays, allowing you to focus on integrating them seamlessly into your game or application without the need for extensive technical expertise.

Why Do I Need a Relay in a P2P Game

A Relay server can be a valuable tool for P2P game developers. In P2P games, players connect directly to each other without the need for a central server. However, this approach can present some challenges, such as:

Firewall restrictions

Firewalls can block P2P connections between devices, making it difficult for players to connect to each other.

Strict NAT

A Strict NAT can have a significant impact on a player's ability to participate in peer-to-peer (P2P) games. P2P games rely on direct connections between players' devices to facilitate communication and gameplay, but a Strict NAT can limit or even block these connections. This can result in increased latency, dropped connections, and difficulty joining or hosting games.


A Relay server can help overcome these challenges by acting as an intermediary between players. When a player wants to connect to another player, their connection is first routed through the Relay server. This allows the Relay server to handle NAT traversal and firewall restrictions, making it easier for players to connect to each other.

Relay servers can also help improve the overall performance of P2P games by reducing the load on player devices. By handling some of the network traffic between players, the Relay server can help reduce latency and improve the overall gameplay experience.


In summary, a Relay server can be a valuable tool for P2P game developers, helping to overcome NAT traversal and firewall restrictions, and improving the overall performance of the game.

Server vs Client in P2P

In a peer-to-peer (P2P) setup for a multiplayer game, one player must act as the game server since there is no dedicated server to manage the game for all players. This player, referred to as the "server," is responsible for managing the game world and synchronizing all information between players. The remaining players (Client) will connect to the server directly.

Getting Started

Implement Some Sort of Lobby/Matchmaker

You will need to implement some form of lobby or matchmaker to create relay sessions for your players. Don't worry, initially you won't need a fully functional matchmaker, but rather something that can automate your API requests without exposing your token in the game client. More information on that in the next section.

Integration with the Edgegap API

Once you have completed the previous step, you will need to primarily perform two straightforward actions using the Edgegap API: creating relay sessions and deleting relay sessions. Your lobby/matchmaker should be responsible for implementing these actions, which will authorize or unauthorize your players from accessing a relay. More information in this section.

Integration with Existing Transport Layer

After authorizing your players on a relay, you will still need to implement the communication between your game client and the relay, which is known as the transport layer.

To make your life easier, we are working to do many implementations for different netcode, language and framework. If you want to integrate one of our actual implementation, simply follow the tutorial corresponding your stack.

(Alternatively) Implementing Your Own Transport Layer

If you are interested in implementing your own transport layer for a specific netcode, you can find detailed information and guidance by following this guide:

Relay Implementation Manual

If you have any question on the implementation or want to know the roadmap on our current integration feel free to reach us!