Documentation

RequestMultiplayerServer

Request a multiplayer server session. Accepts tokens for title and if game client accesss is enabled, allows game client to request a server with player entity token.

Request Details

Requests a multiplayer server session from a particular build in any of the given preferred regions.

RequestMultiplayerServerRequest
Request Properties
BuildId (required) String

The guid string build ID of the multiplayer server to request.

InitialPlayers List<String>

Initial list of players (potentially matchmade) allowed to connect to the game. This list is passed to the game server when requested (via GSDK) and can be used to validate players connecting to it.

PreferredRegions (required) List<AzureRegion>

The preferred regions to request a multiplayer server from. The Multiplayer Service will iterate through the regions in the specified order and allocate a server from the first one that has servers available.

SessionCookie String

Data encoded as a string that is passed to the game server when requested. This can be used to to communicate information such as game mode or map through the request flow.

SessionId (required) String

A guid string session ID created track the multiplayer server session over its life.

POST https://{{TitleID}}.playfabapi.com/MultiplayerServer/RequestMultiplayerServer
    Content-Type: application/json
{
  "BuildId": "21781fa8-096d-4d9c-b699-75433d579285",
  "SessionId": "02bdef0e-e01e-4b29-8efe-ff9f47a06d8c",
  "SessionCookie": "U2Vzc2lvbkNvb2tpZQ==",
  "InitialPlayers": [
    "gamer1",
    "gamer2"
  ],
  "PreferredRegions": [
    "SouthCentralUs",
    "WestUs"
  ]
}
        

Response Details

RequestMultiplayerServerResponse
Result Properties
ConnectedPlayers List<ConnectedPlayer>

The connected players in the multiplayer server.

FQDN String

The fully qualified domain name of the virtual machine that is hosting this multiplayer server.

IPV4Address String

The IPv4 address of the virtual machine that is hosting this multiplayer server.

LastStateTransitionTime DateTime

The time (UTC) at which a change in the multiplayer server state was observed.

Ports List<Port>

The ports the multiplayer server uses.

Region AzureRegion

The region the multiplayer server is located in.

ServerId String

The string server ID of the multiplayer server generated by PlayFab.

SessionId String

The guid string session ID of the multiplayer server.

State String

The state of the multiplayer server.

VmId String

The virtual machine ID that the multiplayer server is located on.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "SessionId": "02bdef0e-e01e-4b29-8efe-ff9f47a06d8c",
    "ServerId": "AMultiplayerGameServer",
    "VmId": "80c00b02-a559-4961-9b31-4a04b39e26a6",
    "IPV4Address": "10.250.24.54",
    "FQDN": "vm.azure.cloudapp.net",
    "Ports": [
      {
        "Name": "PortName",
        "Num": 1243,
        "Protocol": "TCP"
      }
    ],
    "Region": "SouthCentralUs",
    "State": "Active",
    "ConnectedPlayers": [
      {
        "PlayerId": "10931352888739351331"
      },
      {
        "PlayerId": "10271352123739051532"
      }
    ]
  }
}

Authentication

EntityToken

Possible Error Codes

Name Code
APINotEnabledForGameClientAccess 1082
MultiplayerServerBadRequest 1382
MultiplayerServerForbidden 1384
MultiplayerServerInternalServerError 1387
MultiplayerServerNotFound 1385
MultiplayerServerTooManyRequests 1380
MultiplayerServerUnauthorized 1383
MultiplayerServerUnavailable 1388