JoinLobbyWithPingData
Adds the caller to the given lobby instance.
Use PingRegions to generate the ping data.
Service | Operation |
---|---|
lobby | JOIN_LOBBY_WITH_PING_DATA |
Method Parameters
Parameter | Description |
---|---|
lobbyId | The lobby instance to join. |
otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. The call will fail if all users can't be added. |
isReady | Initial ready-status of this user. |
extraJson | Initial extra-data about this user. |
teamCode | Preferred team for this user, if applicable. Send "" or null for automatic assignment. |
pingData | Ping times for each region available for this lobby type. Can use GET_REGIONS_FOR_LOBBIES to retreive the list of regions for a given lobby type. Ping data is automatically passed in on the clients. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string lobbyId = "123456:4v4:3";
string[] otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" };
bool isReady = false;
string extraJson = "{}";
string teamCode = "blue";
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.LobbyService.JoinLobbyWithPingData(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, successCallback, failureCallback);
const char *lobbyId = "123456:4v4:3";
std::vector<std::string> otherUserCxIds;
otherUserCxIds.push_back("123456:aaa-bbb-ccc-ddd:asdfjkl");
bool isReady = false;
const char *extraJson = "{}";
const char *teamCode = "blue";
_bc->getLobbyService()->joinLobbyWithPingData(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, this);
NSString *lobbyId = @"123456:4v4:3";
NSArray *otherUserCxIds = @[ @"123456:aaa-bbb-ccc-ddd:asdfjkl" ];
bool isReady = false;
NSString *extraJson = @"{}";
NSString *teamCode = @"blue";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc lobbyService] joinLobbyWithPingData:lobbyId
otherUserCxIds:otherUserCxIds
isReady:isReady
extraJson:extraJson
teamCode:teamCode
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String lobbyId = "123456:4v4:3";
String[] otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" };
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback
_bc.getLobbyService().joinLobbyWithPingData(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var lobbyId = "123456:4v4:3";
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";
_bc.lobby.joinLobbyWithPingData(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var lobbyId = "123456:4v4:3";
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";
ServerResponse result = await _bc.lobbyService.joinLobbyWithPingData(lobbyId:lobbyId, otherUserCxIds:otherUserCxIds, isReady:isReady, extraJson:extraJson, teamCode:teamCode);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var lobbyId = "123456:4v4:3";
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";
var pingData = {
"ca-central-1": 98,
"us-west-1": 123
};
var lobbyProxy = bridge.getLobbyServiceProxy();
var postResult = lobbyProxy.joinLobbyWithPingData(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, pingData);
if (postResult.status == 200) {
// Success!
}
{
"service": "lobby",
"operation": "JOIN_LOBBY_WITH_PING_DATA",
"data": {
"lobbyId": "55555:4v4:3",
"otherUserCxIds": [
"55555:aaa-bbb-ccc-ddd:asdfjkl"
],
"isReady": false,
"extraJson": {},
"teamCode": "blue",
"pingData": {
"ca-central-1": 98,
"us-west-1": 123
}
}
}