Skip to main content
Version: 5.7.0

CreateMatch

Creates an instance of an asynchronous match.

Opponents is a JSON array containing objects with a Platform and player ID. Platforms are identified as:

  • BC - a brainCloud profile id
  • FB - a Facebook id
  • STEAM - a Steam id
  • PSN - a Playstation id

An example of this string would be:

[{ "platform":"BC", "id": "some-braincloud-profile" }, { "platform":"FB", "id": "some-facebook-id" }]

ServiceOperation
asyncMatchCREATE

Method Parameters

ParameterDescription
jsonOpponentIdsList of objects identifying the opponent platform and id for this match.
pushNotificationMessageOptional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.

Usage

http://localhost:3000
string jsonOpponentIds = "[{\"platform\":\"BC\",\"id\":\"profile ID-1\"},{\"platform\":\"FB\",\"id\":\"Facebook ID-1\"},{\"platform\":\"FB\",\"id\":\"Facebook ID-2\"}]";
string pushNotificationMessage = "You have been entered into an async-match!";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.AsyncMatchService.CreateMatch(jsonOpponentIds, pushNotificationMessage, successCallback, failureCallback);
JSON Response
{
"status" : 200,
"data" :
{
"gameId": "com.dnadpk.football",
"ownerId": "0df9f282-183b-4d67-866e-670fb35a2376",
"matchId": "match1",
"version": 0,
"players": [
{
"playerId": "0df9f282-183b-4d67-866e-670fb35a2376",
"playerName": "",
"pictureUrl": null,
"summaryFriendData": null
},
{
"playerId": "4693ec75-3a99-4577-aef7-0f41d299339c",
"playerName": "Presto1",
"pictureUrl": null,
"summaryFriendData": null
}
],
"status": {
"status": "NOT_STARTED",
"currentPlayer": "0df9f282-183b-4d67-866e-670fb35a2376"
},
"summary": null,
"createdAt": 1415641372974,
"updatedAt": 1415641372974
}
}