Discover how Edgegap works

Discover how Edgegap works

/

PlayFab

/

PlayFab

Deploy to Edgegap

Published

Published

Published

Last reviewed for accuracy

Last reviewed for accuracy

Last reviewed for accuracy

PlayFab: How to start Edgegap dedicated servers from PlayFab Matchmaking

PlayFab: How to start Edgegap dedicated servers from PlayFab Matchmaking

This guide shows you how to keep PlayFab for your player accounts and matchmaking queues, and start an Edgegap dedicated game server for each match: when PlayFab finds a match, an Azure Function deploys a server near the players, and a second one hands its address to every player.

Once your game server is containerized, Edgegap deploys it worldwide to 615+ Edge Cloud locations (on-demand) from a simple API call and billed exclusively on usage: no entire server to rent, provision or keep running between matches. For persistent servers of reserved capacity, Edgegap offers Private Fleets.

PlayFab groups the players; Edgegap hosts the match. The two functions run in your Azure subscription as PlayFab's CloudScript using Azure Functions, so your Edgegap API token and PlayFab secret key stay there: the game client holds only your title ID, and the game server holds no secret at all.

This guide covers:

  1. Preparing a working Edgegap app version, a PlayFab title and an Azure subscription

  2. Connecting your coding agent to Edgegap (optional)

  3. Setting up a PlayFab matchmaking queue

  4. Adding the Azure Function that deploys the server

  5. Handing the server's address to the players

  6. Matching players from your game client

  7. Testing with two players

You can do it two ways, and mix them:

  • With a coding agent. Connect Claude Code, Cursor or another agent to the Edgegap MCP server and its agent skills. The edgegap-playfab skill ships the tested Azure Functions, setup scripts and a Unity client, and the agent checks your app version and deployments. You handle your PlayFab, Azure and Edgegap dashboards, the secrets, and playtest.

  • By hand. Every step below also works without an agent.

Want to see it working first? The SpaceEdge sample runs this whole setup in a small Unity space shooter.

No credit card required. Free tier includes the resources to deploy a real game server.

No credit card required. Free tier includes the resources to deploy a real game server.

Step-by-Step Guide

Detailed Integration Steps

1. Before you start

  • A free Edgegap account. Verify your email. No credit card is needed to test.

  • A working Edgegap app version of your game server: a server you deployed and joined at least once. PlayFab starts that version for every match, so it needs a functional, containerized game server to work end to end. If you don't have one yet, use our guides: Unity Engine, Unreal Engine, Godot Engine or Custom Engine. Name its game port gameport, and note the application and version names. The server needs no PlayFab settings or secrets.

  • A PlayFab title with Matchmaking, and access to its Game Manager: you need its Title ID and a secret key.

  • An Azure subscription and the Azure CLI, for the two Azure Functions. Testing fits in the Flex Consumption plan's monthly free grant.

  • An Edgegap API token, from Dashboard → User Settings → Tokens. It goes only in your Function App's settings. It is organization-wide, so never put it in your game client, your game server, your project files or a chat.

  • Optional: Edgegap's PlayFab sample, a Unity 2021.3 project with the two Azure Functions, the client and the server code below.

2. Connect your coding agent to Edgegap

Skip this step if you're doing everything by hand.

The Edgegap MCP server lets your agent check your apps and versions, deploy test servers and read their logs on your account. The edgegap-playfab agent skill gives it the tested PlayFab setup: the two Azure Functions, the scripts that deploy them and create the queue, a Unity client, and the fixes for PlayFab’s known pitfalls.

Claude Code: install the Edgegap plugin. It adds both the MCP server and the skills, and asks for your API token during install (stored in your system's credential store):

/plugin marketplace add edgegap/llm-agent-skills, then /plugin install edgegap@edgegap. Restart the session.

Only want the MCP server, without the plugin? Run this in your own terminal instead: claude mcp add --transport http edgegap https://mcp.edgegap.dev/mcp -H "Authorization: token YOUR_EDGEGAP_API_TOKEN" --scope user. Don't do both, or you'll have two edgegap servers.

Cursor, VS Code and other clients that send headers: add https://mcp.edgegap.dev/mcp with the header Authorization: token YOUR_EDGEGAP_API_TOKEN, and install the skills with npx skills add edgegap/llm-agent-skills --skill "*".

Claude Desktop: custom connectors can't send the header, so use the local server instead (Node 18+): { "mcpServers": { "edgegap": { "command": "npx", "args": ["-y", "@edgegap/mcp"] } } }. It asks for the token on first use.

Check it works:

"List my Edgegap apps and their versions, with each version's ports."

3. Set up a PlayFab matchmaking queue

  1. In PlayFab's Game Manager, open Multiplayer → Matchmaking and create a queue, or reuse yours. For a first test, a match size of 2 with no rules matches any two players.

  2. Turn Enable server allocation off on the queue: PlayFab only forms the match, and Edgegap hosts the server.

  3. If your game signs players in with LoginWithCustomID or a device ID, open Title settings → API Features and untick Disable player creation using Client/LoginWithCustomId. New titles have it ticked, and logins fail with PlayerCreationDisabled.

  4. In Title settings → Secret Keys, create a secret key for the Azure Functions.

Your match rules stay in PlayFab. Edgegap only starts the server once PlayFab has found the match.

Moving an existing queue off PlayFab Multiplayer Servers? Clients you already shipped read the server from GetMatch, which stops returning it once allocation is off. Test on a copy of the queue, and ship the new client before you switch.

4. Add the Azure Function that deploys the server

The Function App. Create one resource group, a storage account and a Flex Consumption Function App on Node.js 22, in a US West region (PlayFab's recommendation). In its settings, add PLAYFAB_TITLE_ID, PLAYFAB_SECRET_KEY, EDGEGAP_API_TOKEN (without the token prefix), EDGEGAP_APP_NAME, EDGEGAP_APP_VERSION, EDGEGAP_PORT_NAME (optional, defaults to gameport) and EDGEGAP_READY_WEBHOOK_URL (step 5). Optional: FALLBACK_LATITUDE / FALLBACK_LONGITUDE, used when PlayFab can’t locate any player.

The function. StartEdgegapDeployment:

  1. Reads the MatchId and QueueName from the match-found event.

  2. Gets the match members, and each player's location with Server/GetPlayerProfile (PlayFab geolocates their login IP).

  3. Calls POST https://api.edgegap.com/v2/deployments with your application and version, the players as users ("user_type": "geo_coordinates"), a tag with the match ID (its first 20 characters), PLAYFAB_MATCH_ID and PLAYFAB_QUEUE_NAME as environment_variables, and webhook_on_ready / webhook_on_error pointing to the second function.

  4. Returns right away, in about a second. It never waits for the server: PlayFab's call times out after 10 seconds, and a server takes 5 to 30 seconds to be ready.

Edgegap picks the best available location for the whole group and answers with a request_id. Log it with the match ID.

match_found fires for every queue of your title. To give Edgegap servers to some queues only, list them in EDGEGAP_QUEUES.

Register it and add the rule. In Automation → CloudScript → Functions, register StartEdgegapDeployment with its URL and function key. Then in Automation → Rules, add a rule: event type playfab.matchmaking.match_found, action Execute Azure Function, function StartEdgegapDeployment.

With your agent:

"Load the edgegap-playfab skill. Deploy its two Azure Functions to a new Flex Consumption Function App in US West, set the app settings from my local env file without printing them, register StartEdgegapDeployment in my PlayFab title, and run the chain test before I add the rule."

Keep the secrets out of sight: the Edgegap token and the PlayFab secret key live only in the Function App's settings. Function keys are secrets too: they're part of the URLs, so don't commit or share those URLs.

5. Hand the server's address to the players

When the server is ready, Edgegap calls the second function, EdgegapDeploymentReady, through the ready webhook. Edgegap calls it, not PlayFab, so don't register it in PlayFab.

  1. It doesn't trust the webhook body: it reads the deployment from the Edgegap API and checks that it carries this match's tag.

  2. It reads the match members again from PlayFab.

  3. It writes {"matchId", "status", "host", "port"} to each player's read-only data, under the key EdgegapServer. Clients can read it but can't change it.

  4. If the server failed, it writes status: "error", so clients stop waiting.

The game server only has to listen on its port and stop itself when the match is over: it calls the ARBITRIUM_DELETE_URL Edgegap gives every deployment, with ARBITRIUM_DELETE_TOKEN. The sample stops when nobody joins within 120 seconds, or 30 seconds after the last player leaves.

For production, pass the match's player IDs to the server (for example as an environment variable from StartEdgegapDeployment) and reject players who aren't in the match.

6. Match players from your game client

  1. The client signs the player in to PlayFab (the sample uses LoginWithCustomID; use your game's login). It holds only your title ID.

  2. It creates a matchmaking ticket in your queue (CreateMatchmakingTicket) and checks it with GetMatchmakingTicket every 6 seconds until the status is Matched. PlayFab allows 10 checks per minute per ticket.

  3. It then reads EdgegapServer with GetUserReadOnlyData every 2 to 3 seconds, and ignores any value whose matchId isn't this match.

  4. It connects to host:port. On status: "error", it shows an error and lets the player queue again.

The sample's Unity client does this with UnityWebRequest and JsonUtility only, with no PlayFab SDK. If your game already uses the SDK, make the same calls through it.

7. Test with two players

  1. Make sure no test deployment is still running: the free tier runs one deployment at a time.

  2. Sign in two clients as two different PlayFab players and start matchmaking on both. On one machine, give each its own player ID: the sample takes -playfabCustomId player-a and -playfabCustomId player-b.

  3. When PlayFab matches them, the rule runs StartEdgegapDeployment. In the Edgegap dashboard, a deployment appears tagged with the start of the match ID, in a location near you.

  4. Both clients read the address from their read-only data and connect to the same server.

  5. Quit both clients: the server stops itself and disappears from the dashboard.

Matched, but no address? Check the Function App's logs (Application Insights, or each function's Monitor tab), and that the rule's event type is exactly playfab.matchmaking.match_found. A 401 from Edgegap means the token is wrong or still has its token prefix. A deployment starts but nobody connects? It's the server: deploy your version by hand and join it directly.

Next Steps

Next Steps

Going live? Ask your agent to run the edgegap-launch skill's checklist: version rollouts, restart policy, maximum duration, cost control. Prefer a hosted matchmaker with no scripts? See Edgegap's matchmaker.

Stuck? Ask your agent to load edgegap-troubleshoot, or ask our team and other studios on the Edgegap Discord.

Frequently Asked Questions

Common questions about hosting PlayFab matches on Edgegap's dedicated servers.

Can I use PlayFab Matchmaking with Edgegap servers?

Yes. Keep your PlayFab queues and rules, and turn server allocation off. When PlayFab finds a match, an Azure Function triggered by the match-found event deploys an Edgegap server near the players, and a second function writes its address to each player's read-only data.

Do I still need PlayFab Multiplayer Servers?

No. Edgegap hosts the dedicated servers. PlayFab keeps your accounts, player data and matchmaking, and Edgegap starts a server only when a match is found, billed per minute while it runs.

How does Edgegap choose the server location for a PlayFab match?

From each player's location, which the Azure Function reads from their PlayFab profile and sends as coordinates. Edgegap picks the best available location for the whole group.

Where does my Edgegap API token go with PlayFab?

Only in your Azure Function App's settings, with your PlayFab secret key. Game clients hold only the title ID, and game servers hold no secret.

How do players get the server address from PlayFab?

When the server is ready, Edgegap calls a webhook function that checks the deployment and writes its host and port to each matched player's read-only data. Each client reads it and connects.

Can I use legacy CloudScript instead of Azure Functions?

The same rule and event drive both, but Microsoft labels JavaScript CloudScript "Legacy" and points new work to CloudScript using Azure Functions. Azure Functions also let the deploy call return at once and receive Edgegap's ready webhook.

Clients

Learn more from clients who integrated Edgegap

31 case studies are available from studios that moved to Edgegap from another platform.

Key reasons why they chose Edgegap

Discover the impact of Edgegap's automated game server orchestration for a flawless multiplayer experience.

Cost

Pricing

Pricing

Optimize costs and performance with hybrid orchestration

Optimize costs and performance with hybrid orchestration

Optimize costs and performance with hybrid orchestration

Edge Cloud

On-Demand

$0.00115

/ vCPU

/ MINUTE

Billed by the Minute, Only on Usage

Pay only when players play. 0 active servers = $0

Deploy game servers worldwide, per instance, to all 615+ edge cloud locations. Zero commitment.

Simply add a credit card.

Edge Cloud

On-Demand

$0.00115

/ vCPU

/ MINUTE

Billed by the Minute, Only on Usage

Pay only when players play. 0 active servers = $0

Deploy game servers worldwide, per instance, to all 615+ edge cloud locations. Zero commitment.

Simply add a credit card.

Edge Cloud

On-Demand

$0.00115

/ vCPU

/ MINUTE

Billed by the Minute, Only on Usage

Pay only when players play. 0 active servers = $0

Deploy game servers worldwide, per instance, to all 615+ edge cloud locations. Zero commitment.

Simply add a credit card.

Private Fleet (Bare Metal)

Reserved Capacity

$0.0261

/ vCPU

/ HOUR

Billed Monthly, Always On

$280 per host/month (12 mo rate), or $350 monthly

Optimize the cost effectiveness of your game server with egress-free hosting of Private Fleets.

Persistent, available 24/7, exclusive to your studio.

Private Fleet (Bare Metal)

Reserved Capacity

$0.0261

/ vCPU

/ HOUR

Billed Monthly, Always On

$280 per host/month (12 mo rate), or $350 monthly

Optimize the cost effectiveness of your game server with egress-free hosting of Private Fleets.

Persistent, available 24/7, exclusive to your studio.

Private Fleet (Bare Metal)

Reserved Capacity

$0.0261

/ vCPU

/ HOUR

Billed Monthly, Always On

$280 per host/month (12 mo rate), or $350 monthly

Optimize the cost effectiveness of your game server with egress-free hosting of Private Fleets.

Persistent, available 24/7, exclusive to your studio.

Your bill varies per rate and usage; which can vary per game type, player count, & more.

Your bill varies per rate and usage; which can vary per game type, player count, & more.

Model your usage with our estimate calculator ->

Model your usage with our estimate calculator ->

Edgegap's features & price: detailed comparison between Edge Cloud & Private Fleets

Edgegap's features & price: detailed comparison between Edge Cloud & Private Fleets

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.