Azure PlayFab Relay
Last updated
Was this helpful?
Last updated
Was this helpful?
is a backend platform for building and operating live games. It provides a suite of managed game services, real-time analytics, and LiveOps tools within a single platform. It provides a free service as well as pay-per-month plans. In order to use PlayFab you'll need to set up a game with a valid PlayFab Title ID. Once you have a PlayFab Title ID, you'll be able to pass messages between clients via PlayFab's servers.
To make things easy, coherence provides a complete PlayFab relay implementation that provides out-of-the-box networking over PlayFab. The PlayFab relay utilizes the to access the PlayFab Party API.
The PlayFab Integration is using a combination of the PlayFab relay servers and an implementation of ICoherenceRelay
to enable PlayFab users to connect and play with each other while avoiding NAT issues. The ICoherenceRelay
implementation allows for users to connect to the hosting client through PlayFab, and have the client forward their data packets to the user-hosted Replication Server.
The sample code in the repository demonstrates how to join and host a game with the PlayFab Party API.
Connecting over PlayFab, step-by-step
The host (Client A) initializes the PlayFabClientAPI that handles PlayFab connections and then starts a Replication Server on its local machine.
The host connects to the local Replication Server and joins the PlayFab network. The host receives the remote server's network ID and host id. These are used by clients to connect to PlayFab's services.
Another player (Client B) connects to the host via PlayFab using the PlayFabTransport.
The PlayFabRelay accepts the incoming connection, creating a PlayFabRelayConnection.
The PlayFabRelayConnection immediately starts passing data between the PlayFab servers and the Replication Server.
The relayed connection is now fully established. All data between Client B and the Replication Server is relayed through PlayFab.
For each new Client that connects, steps 3-6 are repeated.