<!-- source: docs/api/2_capi/lobby/cancelfindrequest.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/cancelfindrequest -->

# CancelFindRequest

Cancels any FindLobby or FindOrCreateLobby requests that have been previously submitted by the caller for the given lobbyType.

| Service | Operation |
| ------- | --------- |
| lobby | CANCEL_FIND_REQUEST |

## Method Parameters

| Parameter | Description                   |
| --------- | ----------------------------- |
| lobbyType | Type of lobby being targeted. |
| entryId   | Specific entry id to cancel.  |

## Usage

**C#:**

```csharp
string lobbyType = "4v4";
string entryId = "cxckfek-ir";
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.CancelFindRequest(lobbyType, entryId, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
const char *entryId = "cxckfek-ir";
_bc->getLobbyService()->cancelFindRequest(lobbyType, entryId, this);
```

**Obj-C:**

```objectivec
// Coming soon
```

**Java:**

```java
String lobbyType = "4v4";
String entryId = "cxckfek-ir";
this; // implements IServerCallback

_bc.getLobbyService().cancelFindRequest(lobbyType, entryId, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var entryId = "cxckfek-ir";

_bc.lobby.cancelFindRequest(lobbyType, entryId, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "4v4";
var  entryId = "cxckfek-ir";

ServerResponse result = await _bc.lobbyService.cancelFindRequest(lobbyType:lobbyType, entryId:entryId);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local entryId = "cxckfek-ir"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:cancelFindRequest(lobbyType, entryId, callback)
```

**GDScript:**

```gdscript
var lobby_type = "4v4"
var entry_id = "cxckfek-ir"

var result = await _bc.lobby_service.cancel_find_request(lobby_type, entry_id)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyType = "4v4"
local entryId = "cxckfek-ir"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:cancelFindRequest(lobbyType, entryId, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var entryId = "cxckfek-ir";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.cancelFindRequest(lobbyType, entryId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "CANCEL_FIND_REQUEST",
    "data": {
        "lobbyType": "4v4",
        "entryId": "cxckfek-ir"
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/createlobby.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/createlobby -->

# CreateLobby

Creates a new lobby.

Sends LOBBY_JOIN_SUCCESS message to the user, with full copy of lobby data
Sends LOBBY_MEMBER_JOINED to all lobby members, with copy of member data

| Service | Operation |
| ------- | --------- |
| lobby | CREATE_LOBBY |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyType | The type of lobby to look for. Lobby types are defined in the portal.
rating | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).
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.
settings | Owner settings for this lobby.
otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.

## Usage

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
bool isReady = false;
string extraJson = "{}";
string teamCode = "blue";
string settings = "{}";
string[] otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" };
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.CreateLobby(lobbyType, rating, isReady, extraJson, teamCode, settings, otherUserCxIds, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
std::vector<std::string> otherUserCxIds;
otherUserCxIds.push_back("55555:aaa-bbb-ccc-ddd:asdfjkl");
const char *settings = "{}";
bool isReady = false;
const char *extraJson = "{}";
const char *teamCode = "blue";
_bc->getLobbyService()->createLobby(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
NSArray *otherUserCxIds = @[ @"55555:aaa-bbb-ccc-ddd:asdfjkl" ];
NSString *settings = @"{}";
bool isReady = false;
NSString *extraJson = @"{}";
NSString *teamCode = @"blue";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] createLobby:lobbyType
                     rating:rating
             otherUserCxIds:otherUserCxIds
                   settings:settings
                    isReady:isReady
                  extraJson:extraJson
                   teamCode:teamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
String[] otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" };
String settings = "{}";
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().createLobby(lobbyType, rating, otherUserCxIds, settings, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
var isReady = false;
var extraJson = {};
var teamCode = "blue";

_bc.lobby.createLobby(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "4v4";
var  rating = 76;
var  otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var  settings = {};
var  isReady = false;
var  extraJson = {};
var  teamCode = "blue";

ServerResponse result = await _bc.lobbyService.createLobby(lobbyType:lobbyType, rating:rating, otherUserCxIds:otherUserCxIds, settings:settings, isReady:isReady, extraJson:extraJson, teamCode:teamCode);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local settings = {}
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:createLobby(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, callback)
```

**GDScript:**

```gdscript
var lobby_type = "4v4"
var rating = 76
var other_user_cx_ids = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ]
var settings = {}
var is_ready = false
var extra_json = {}
var team_code = "blue"

var result = await _bc.lobby_service.create_lobby(lobby_type, rating, is_ready, extra_json, team_code, settings, other_user_cx_ids)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"
local settings = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:createLobby(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
var isReady = false;
var extraJson = {};
var teamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.createLobby(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "CREATE_LOBBY",
    "data": {
        "lobbyType": "4v4",
        "rating": 76,
        "otherUserCxIds": [
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "settings": {},
        "isReady": false,
        "extraJson": {},
        "teamCode": "blue"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```
</details>

<details>
<summary>Common Error Code</summary>

### Status Codes
Code | Name | Description
---- | ---- | -----------
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature

</details>


---

<!-- source: docs/api/2_capi/lobby/createlobbywithconfig.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/createlobbywithconfig -->

# CreateLobbyWithConfig
Creates an instance of a lobby with a per-instance configuration override. Currently supports overriding the standard lobby type's team definitions. Will return the newly created lobby id in the event of a successful creation.

| Service | Operation |
| ------- | --------- |
| lobby | CREATE_LOBBY_WITH_CONFIG |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyType | The type of lobby to look for. Lobby types are defined in the portal.
rating | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).
otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.
settings | Owner settings for this lobby.
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.
configOverrides | Per-instance configuration overrides applied on top of the standard lobby type. Currently supports `teams` (a complete replacement list of team definitions: `code`, `minUsers`, `maxUsers`, `autoAssign`).

## Usage

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
string otherUserCxIds = "[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
string settings = "{}";
bool isReady = False;
string extraJson = "{}";
string teamCode = "reserved";
string configOverrides = "{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
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.CreateLobbyWithConfig(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
const char *otherUserCxIds = "[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
const char *settings = "{}";
bool isReady = False;
const char *extraJson = "{}";
const char *teamCode = "reserved";
const char *configOverrides = "{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
_bc.getLobbyService().createLobbyWithConfig(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
NSString *otherUserCxIds = @"[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
NSString *settings = @"{}";
BOOL isReady = False;
NSString *extraJson = @"{}";
NSString *teamCode = @"reserved";
NSString *configOverrides = @"{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc lobbyService] createLobbyWithConfig:
                    lobbyType:lobbyType
                       rating:rating
               otherUserCxIds:otherUserCxIds
                     settings:settings
                      isReady:isReady
                    extraJson:extraJson
                     teamCode:teamCode
              configOverrides:configOverrides
              completionBlock:successBlock
         errorCompletionBlock:failureBlock
                     cbObject:nil]
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
String otherUserCxIds = "[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
String settings = "{}";
bool isReady = False;
String extraJson = "{}";
String teamCode = "reserved";
String configOverrides = "{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
this; // implements IServerCallback
_bc.getLobbyService.createLobbyWithConfig(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
_bc.lobby.createLobbyWithConfig(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, result =>
{
  var status = result.status;
  console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
ServerResponse result = await _bc.lobbyService.createLobbyWithConfig(lobbyType:lobbyType, rating:rating, otherUserCxIds:otherUserCxIds, settings:settings, isReady:isReady, extraJson:extraJson, teamCode:teamCode, configOverrides:configOverrides);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = {
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
}
local settings = {}
local isReady = false
local extraJson = {}
local teamCode = "reserved"
local configOverrides = {
    teams= {
        {
            code= "reserved",
            minUsers= 0,
            maxUsers= 1,
            autoAssign= false
        },
        {
            code= "all",
            minUsers= 6,
            maxUsers= 6,
            autoAssign= true
        }
    }
}
local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end
_bc.lobby:createLobbyWithConfig(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, configOverrides, callback)
```

**GDScript:**

```gdscript
var lobby_type = "4v4"
var rating = 76
var other_user_cx_ids = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
]
var settings = {}
var is_ready = False
var extra_json = {}
var team_code = "reserved"
var config_overrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
}

var result = await _bc.lobby_service.create_lobby_with_config(lobby_type, rating, is_ready, extra_json, team_code, settings, config_overrides, other_user_cx_ids)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "reserved"
local settings = {}
local configOverrides = {
    teams = {
        {
            code = "reserved",
            minUsers = 0,
            maxUsers = 1,
            autoAssign = false
        },
        { code = "all", minUsers = 6, maxUsers = 6, autoAssign = true }
    }
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:createLobbyWithConfig(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, configOverrides, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.createLobbyWithConfig(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"CREATE_LOBBY_WITH_CONFIG",
    "data":{
        "lobbyType":"4v4",
        "rating":76,
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "settings":{},
        "isReady":false,
        "extraJson":{},
        "teamCode":"reserved",
        "configOverrides":{
            "teams":[
                {
                    "code":"reserved",
                    "minUsers":0,
                    "maxUsers":1,
                    "autoAssign":false
                },
                {
                    "code":"all",
                    "minUsers":6,
                    "maxUsers":6,
                    "autoAssign":true
                }
            ]
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
  "data": {
    "lobbyId": "23782:Relay_lobbyT_v2:1"
  },
  "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/createlobbywithconfigandpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/createlobbywithconfigandpingdata -->

# CreateLobbyWithConfigAndPingData
Creates an instance of a lobby with a per-instance configuration override and the given ping data. Currently supports overriding the standard lobby type's team definitions. Will return the newly created lobby id in the event of a successful creation.

| Service | Operation |
| ------- | --------- |
| lobby | CREATE_LOBBY_WITH_CONFIG_AND_PING_DATA |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyType | The type of lobby to look for. Lobby types are defined in the portal.
rating | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).
otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.
settings | Owner settings for this lobby.
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.
configOverrides | Per-instance configuration overrides applied on top of the standard lobby type. Currently supports `teams` (a complete replacement list of team definitions: `code`, `minUsers`, `maxUsers`, `autoAssign`).
pingData | Ping times for each region available for this lobby type. Can use GET_REGIONS_FOR_LOBBIES to retrieve the list of regions for a given lobby type.

## Usage

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
string otherUserCxIds = "[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
string settings = "{}";
bool isReady = False;
string extraJson = "{}";
string teamCode = "reserved";
string configOverrides = "{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
string pingData = "{\"ca-central-1\": 98, \"us-west-1\": 123}";
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.CreateLobbyWithConfigAndPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, pingData, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
const char *otherUserCxIds = "[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
const char *settings = "{}";
bool isReady = False;
const char *extraJson = "{}";
const char *teamCode = "reserved";
const char *configOverrides = "{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
const char *pingData = "{\"ca-central-1\": 98, \"us-west-1\": 123}";
_bc.getLobbyService().createLobbyWithConfigAndPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, pingData, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
NSString *otherUserCxIds = @"[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
NSString *settings = @"{}";
BOOL isReady = False;
NSString *extraJson = @"{}";
NSString *teamCode = @"reserved";
NSString *configOverrides = @"{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
NSString *pingData = @"{\"ca-central-1\": 98, \"us-west-1\": 123}";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc lobbyService] createLobbyWithConfigAndPingData:
                    lobbyType:lobbyType
                       rating:rating
               otherUserCxIds:otherUserCxIds
                     settings:settings
                      isReady:isReady
                    extraJson:extraJson
                     teamCode:teamCode
              configOverrides:configOverrides
                     pingData:pingData
              completionBlock:successBlock
         errorCompletionBlock:failureBlock
                     cbObject:nil]
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
String otherUserCxIds = "[\"55555:aaa-bbb-ccc-ddd:asdfjkl\"]";
String settings = "{}";
bool isReady = False;
String extraJson = "{}";
String teamCode = "reserved";
String configOverrides = "{\"teams\": [{\"code\": \"reserved\", \"minUsers\": 0, \"maxUsers\": 1, \"autoAssign\": False}, {\"code\": \"all\", \"minUsers\": 6, \"maxUsers\": 6, \"autoAssign\": True}]}";
String pingData = "{\"ca-central-1\": 98, \"us-west-1\": 123}";
this; // implements IServerCallback
_bc.getLobbyService.createLobbyWithConfigAndPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, pingData, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
var pingData = {
    "ca-central-1": 98,
    "us-west-1": 123
};
_bc.lobby.createLobbyWithConfigAndPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, pingData, result =>
{
  var status = result.status;
  console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
var pingData = {
    "ca-central-1": 98,
    "us-west-1": 123
};
ServerResponse result = await _bc.lobbyService.createLobbyWithConfigAndPingData(lobbyType:lobbyType, rating:rating, otherUserCxIds:otherUserCxIds, settings:settings, isReady:isReady, extraJson:extraJson, teamCode:teamCode, configOverrides:configOverrides, pingData:pingData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "reserved"
local settings = {}
local configOverrides = {
    teams = {
        { code = "reserved", minUsers = 0, maxUsers = 1, autoAssign = false },
        { code = "all", minUsers = 6, maxUsers = 6, autoAssign = true }
    }
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:createLobbyWithConfigAndPingData(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, configOverrides, callback)
```

**GDScript:**

```gdscript
var lobby_type = "4v4"
var rating = 76
var other_user_cx_ids = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
]
var settings = {}
var is_ready = False
var extra_json = {}
var team_code = "reserved"
var config_overrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
}
var ping_data = {
    "ca-central-1": 98,
    "us-west-1": 123
}

var result = await _bc.lobby_service.create_lobby_with_config_and_ping_data(lobby_type, rating, is_ready, extra_json, team_code, settings, config_overrides, ping_data, other_user_cx_ids)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "reserved"
local settings = {}
local configOverrides = {
    teams = {
        { code = "reserved", minUsers = 0, maxUsers = 1, autoAssign = false },
        { code = "all", minUsers = 6, maxUsers = 6, autoAssign = true }
    }
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:createLobbyWithConfigAndPingData(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, configOverrides, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-ddd:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
var pingData = {
    "ca-central-1": 98,
    "us-west-1": 123
};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.createLobbyWithConfigAndPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, pingData);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"CREATE_LOBBY_WITH_CONFIG_AND_PING_DATA",
    "data":{
        "lobbyType":"4v4",
        "rating":76,
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "settings":{},
        "isReady":false,
        "extraJson":{},
        "teamCode":"reserved",
        "configOverrides":{
            "teams":[
                {
                    "code":"reserved",
                    "minUsers":0,
                    "maxUsers":1,
                    "autoAssign":false
                },
                {
                    "code":"all",
                    "minUsers":6,
                    "maxUsers":6,
                    "autoAssign":true
                }
            ]
        },
        "pingData":{
            "ca-central-1":98,
            "us-west-1":123
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
  "data": {
    "lobbyId": "23782:Relay_lobbyT_v2:1"
  },
  "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/createlobbywithpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/createlobbywithpingdata -->

# CreateLobbyWithPingData

Creates an instance of a lobby.

Use [PingRegions](/api/capi/lobby/pingregions) to generate the ping data.

| Service | Operation |
| ------- | --------- |
| lobby | CREATE_LOBBY_WITH_PING_DATA |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyType | The type of lobby to look for. Lobby types are defined in the portal.
rating | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).
otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.
settings | Owner settings for this lobby.
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. pingData is automatically passed in on the client.

## Usage

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
string[] otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" };
string settings = "{}";
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.CreateLobbyWithPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
std::vector<std::string> otherUserCxIds;
otherUserCxIds.push_back("123456:aaa-bbb-ccc-ddd:asdfjkl");
const char *settings = "{}";
bool isReady = false;
const char *extraJson = "{}";
const char *teamCode = "blue";
_bc->getLobbyService()->createLobbyWithPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
NSArray *otherUserCxIds = @[ @"123456:aaa-bbb-ccc-ddd:asdfjkl" ];
NSString *settings = @"{}";
bool isReady = false;
NSString *extraJson = @"{}";
NSString *teamCode = @"blue";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] createLobbyWithPingData:lobbyType
                     rating:rating
             otherUserCxIds:otherUserCxIds
                   settings:settings
                    isReady:isReady
                  extraJson:extraJson
                   teamCode:teamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
String[] otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" };
String settings = "{}";
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().createLobbyWithPingData(lobbyType, rating, otherUserCxIds, settings, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
var isReady = false;
var extraJson = {};
var teamCode = "blue";

_bc.lobby.createLobbyWithPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "4v4";
var  rating = 76;
var  otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var  settings = {};
var  isReady = false;
var  extraJson = {};
var  teamCode = "blue";

ServerResponse result = await _bc.lobbyService.createLobbyWithPingData(lobbyType:lobbyType, rating:rating, otherUserCxIds:otherUserCxIds, settings:settings, isReady:isReady, extraJson:extraJson, teamCode:teamCode);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }
local settings = {}
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:createLobbyWithPingData(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, callback)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyType = "4v4"
local rating = 76
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"
local settings = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:createLobbyWithPingData(lobbyType, rating, otherUserCxIds, isReady, extraJson, teamCode, settings, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
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.createLobbyWithPingData(lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, pingData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "CREATE_LOBBY_WITH_PING_DATA",
    "data": {
        "lobbyType": "4v4",
        "rating": 76,
        "otherUserCxIds": [
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "settings": {},
        "isReady": false,
        "extraJson": {},
        "teamCode": "blue",
        "pingData": {
            "ca-central-1": 98,
            "us-west-1": 123
        }
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/findlobby.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/findlobby -->

# FindLobby

Finds a lobby matching the specified parameters. Asynchronous - returns 200 to indicate that matchmaking has started.

| Service | Operation |
| ------- | --------- |
| lobby | FIND_LOBBY |

## Method Parameters

| Parameter      | Description                                                                                                                                                                          |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| lobbyType      | The type of lobby to look for. Lobby types are defined in the portal.                                                                                                                |
| rating         | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved). |
| maxSteps       | The maximum number of steps to wait when looking for an applicable lobby. Each step is ~5 seconds.                                                                                   |
| algo           | The algorithm to use for increasing the search scope.                                                                                                                                |
| filterJson     | Used to help filter the list of rooms to consider. Passed to the matchmaking filter, if configured.                                                                                  |
| otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.                      |
| 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.                                                                                           |

## Usage

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
string algo = "{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
string filterJson = "{\"cheater\":false}";
string[] otherUserCxIds = { "55555: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.FindLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
const char *algo = "{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
const char *filterJson = "{\"cheater\":false}";
std::vector<std::string> otherUserCxIds;
otherUserCxIds.push_back("55555:aaa-bbb-ccc-ddd:asdfjkl");
bool isReady = false;
const char *extraJson = "{}";
const char *teamCode = "blue";
_bc->getLobbyService()->findLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
int maxSteps = 3;
NSString *algo = @"{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
NSString *filterJson = @"{\"cheater\":false}";
NSArray *otherUserCxIds = @[ @"55555:aaa-bbb-ccc-ddd:asdfjkl" ];
bool isReady = false;
NSString *extraJson = @"{}";
NSString *teamCode = @"blue";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] findLobby:lobbyType
                     rating:rating
                   maxSteps:maxSteps
                       algo:algo
                 filterJson:filterJson
             otherUserCxIds:otherUserCxIds
                    isReady:isReady
                  extraJson:extraJson
                   teamCode:teamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
String algo = "{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
String filterJson = "{\"cheater\":false}";
String[] otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" };
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().findLobby(lobbyType, rating, maxSteps, algo, filterJson, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
};
var filterJson = {
    "cheater": false
};
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";

_bc.lobby.findLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "4v4";
var  rating = 76;
var  maxSteps = 3;
var  algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
};
var  filterJson = {
    "cheater": false
};
var  otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var  isReady = false;
var  extraJson = {};
var  teamCode = "blue";

ServerResponse result = await _bc.lobbyService.findLobby(lobbyType:lobbyType, rating:rating, maxSteps:maxSteps, algo:algo, filterJson:filterJson, otherUserCxIds:otherUserCxIds, isReady:isReady, extraJson:extraJson, teamCode:teamCode);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "ranged-absolute",
    alignment = "center",
    ranges = {
        5,
        7.5,
        10
    }
}
local filterJson = {
    cheater = false
}
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, callback)
```

**GDScript:**

```gdscript
var lobby_type = "4v4"
var rating = 76
var max_steps = 3
var algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
}
var filter_json = {
    "cheater": false
}
var other_user_cx_ids = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ]
var is_ready = false
var extra_json = {}
var team_code = "blue"

var result = await _bc.lobby_service.find_lobby(lobby_type, rating, max_steps, algo, filter_json, is_ready, extra_json, team_code, other_user_cx_ids)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "ranged-absolute",
    alignment = "center",
    ranges = { 5, 7.5, 10 }
}
local filterJson = { cheater = false }
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
};
var filterJson = {
    "cheater": false
};
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.findLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "FIND_LOBBY",
    "data": {
        "lobbyType": "4v4",
        "rating": 76,
        "maxSteps": 3,
        "algo": {
            "strategy": "ranged-absolute",
            "alignment": "center",
            "ranges": [
                5,
                7.5,
                10
            ]
        },
        "filterJson": {
            "cheater": false
        },
        "otherUserCxIds": [
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "isReady": false,
        "extraJson": {},
        "teamCode": "blue"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {
        "entryId": "7483a8-a27"
    }
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/2_capi/lobby/findlobbywithpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/findlobbywithpingdata -->

# FindLobbyWithPingData

Adds the caller to the lobby entry queue.

Use [PingRegions](/api/capi/lobby/pingregions) to generate the ping data.

| Service | Operation |
| ------- | --------- |
| lobby | FIND_LOBBY_WITH_PING_DATA |

## Method Parameters

| Parameter      | Description                                                                                                                                                                                            |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| lobbyType      | The type of lobby to look for. Lobby types are defined in the portal.                                                                                                                                  |
| rating         | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).                   |
| maxSteps       | The maximum number of steps to wait when looking for an applicable lobby. Each step is ~5 seconds.                                                                                                     |
| algo           | The algorithm to use for increasing the search scope.                                                                                                                                                  |
| filterJson     | Used to help filter the list of rooms to consider. Passed to the matchmaking filter, if configured.                                                                                                    |
| 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.                                                                                                             |
| otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.                                        |
| 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

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
string algo = "{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
string filterJson = "{\"cheater\":false}";
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.FindLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
const char *algo = "{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
const char *filterJson = "{\"cheater\":false}";
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()->findLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
int maxSteps = 3;
NSString *algo = @"{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
NSString *filterJson = @"{\"cheater\":false}";
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] findLobbyWithPingData:lobbyType
                     rating:rating
                   maxSteps:maxSteps
                       algo:algo
                 filterJson:filterJson
             otherUserCxIds:otherUserCxIds
                    isReady:isReady
                  extraJson:extraJson
                   teamCode:teamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
String algo = "{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
String filterJson = "{\"cheater\":false}";
String[] otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" };
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().findLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
};
var filterJson = {
    "cheater": false
};
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";

_bc.lobby.findLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "4v4";
var  rating = 76;
var  maxSteps = 3;
var  algo = {
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
};
var  filterJson = {
    "cheater": false
};
var  otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var  isReady = false;
var  extraJson = {};
var  teamCode = "blue";

ServerResponse result = await _bc.lobbyService.findLobbyWithPingData(lobbyType:lobbyType, rating:rating, maxSteps:maxSteps, algo:algo, filterJson:filterJson, otherUserCxIds:otherUserCxIds, isReady:isReady, extraJson:extraJson, teamCode:teamCode);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "compound",
    algos = {
        { criteria = "ping", strategy = "absolute", alignment = "absolute" },
        {
            criteria = "rating",
            strategy = "ranged-absolute",
            alignment = "center"
        }
    },
    ["compound-ranges"] = { {30, {5, 10 }},
        { 50, {10, 15 }}
    }
}
local filterJson = {
    cheater = false
}
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, callback)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "compound",
    algos = {
        {
            criteria = "ping",
            strategy = "absolute",
            alignment = "absolute"
        },
        {
            criteria = "rating",
            strategy = "ranged-absolute",
            alignment = "center"
        }
    },
    ["compound-ranges"] = { { 30, { 5, 10 } }, { 50, { 10, 15 } } }
}
local filterJson = { cheater = false }
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
};
var filterJson = {
    "cheater": false
};
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.findLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, isReady, extraJson, teamCode, pingData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "FIND_LOBBY_WITH_PING_DATA",
    "data": {
        "lobbyType": "4v4",
        "rating": 76,
        "maxSteps": 3,
        "algo": {
            "strategy": "compound",
            "algos": [
                { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
                {
                    "criteria": "rating",
                    "strategy": "ranged-absolute",
                    "alignment": "center"
                }
            ],
            "compound-ranges": [
                [30, [5, 10]],
                [50, [10, 15]]
            ]
        },
        "filterJson": {
            "cheater": false
        },
        "otherUserCxIds": [
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "isReady": false,
        "extraJson": {},
        "teamCode": "blue",
        "pingData": {
            "ca-central-1": 98,
            "us-west-1": 123
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {
        "entryId": "7483a8-a27"
    }
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/findorcreatelobby.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/findorcreatelobby -->

# FindOrCreateLobby

Finds a lobby matching the specified parameters, or creates one. Asynchronous - returns 200 to indicate that matchmaking has started.

| Service | Operation |
| ------- | --------- |
| lobby | FIND_OR_CREATE_LOBBY |

## Method Parameters

| Parameter      | Description                                                                                                                                                                          |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| lobbyType      | The type of lobby to look for. Lobby types are defined in the portal.                                                                                                                |
| rating         | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved). |
| maxSteps       | The maximum number of steps to wait when looking for an applicable lobby. Each step is ~5 seconds.                                                                                   |
| algo           | The algorithm to use for increasing the search scope.                                                                                                                                |
| filterJson     | Used to help filter the list of rooms to consider. Passed to the matchmaking filter, if configured.                                                                                  |
| otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.                      |
| settings       | Owner settings for this lobby.                                                                                                                                                       |
| 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.                                                                                           |

## Usage

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
string algo = "{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
string filterJson = "{\"cheater\":false}";
string[] otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" };
string settings = "{}";
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.FindOrCreateLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
const char *algo = "{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
const char *filterJson = "{\"cheater\":false}";
std::vector<std::string> otherUserCxIds;
otherUserCxIds.push_back("55555:aaa-bbb-ccc-ddd:asdfjkl");
const char *settings = "{}";
bool isReady = false;
const char *extraJson = "{}";
const char *teamCode = "blue";
_bc->getLobbyService()->findOrCreateLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
int maxSteps = 3;
NSString *algo = @"{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
NSString *filterJson = @"{\"cheater\":false}";
NSArray *otherUserCxIds = @[ @"55555:aaa-bbb-ccc-ddd:asdfjkl" ];
NSString *settings = @"{}";
bool isReady = false;
NSString *extraJson = @"{}";
NSString *teamCode = @"blue";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] findOrCreateLobby:lobbyType
                     rating:rating
                   maxSteps:maxSteps
                       algo:algo
                 filterJson:filterJson
             otherUserCxIds:otherUserCxIds
                   settings:settings
                    isReady:isReady
                  extraJson:extraJson
                   teamCode:teamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
String algo = "{\"strategy\":\"ranged-absolute\",\"alignment\":\"center\",\"ranges\":[5,7.5,10]}";
String filterJson = "{\"cheater\":false}";
String[] otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" };
String settings = "{}";
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().findOrCreateLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
};
var filterJson = {
    "cheater": false
};
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
var isReady = false;
var extraJson = {};
var teamCode = "blue";

_bc.lobby.findOrCreateLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "4v4";
var  rating = 76;
var  maxSteps = 3;
var  algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
};
var  filterJson = {
    "cheater": false
};
var  otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var  settings = {};
var  isReady = false;
var  extraJson = {};
var  teamCode = "blue";

ServerResponse result = await _bc.lobbyService.findOrCreateLobby(lobbyType:lobbyType, rating:rating, maxSteps:maxSteps, algo:algo, filterJson:filterJson, otherUserCxIds:otherUserCxIds, settings:settings, isReady:isReady, extraJson:extraJson, teamCode:teamCode);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "ranged-absolute",
    alignment = "center",
    ranges = {
        5,
        7.5,
        10
    }
}
local filterJson = {
    cheater = false
}
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local settings = {}
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findOrCreateLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, callback)
```

**GDScript:**

```gdscript
var lobby_type = "4v4"
var rating = 76
var max_steps = 3
var algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
}
var filter_json = {
    "cheater": false
}
var other_user_cx_ids = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ]
var settings = {}
var is_ready = false
var extra_json = {}
var team_code = "blue"

var result = await _bc.lobby_service.find_or_create_lobby(lobby_type, rating, max_steps, algo, filter_json, settings, is_ready, extra_json, team_code, other_user_cx_ids)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "ranged-absolute",
    alignment = "center",
    ranges = { 5, 7.5, 10 }
}
local filterJson = { cheater = false }
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local settings = {}
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findOrCreateLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "ranged-absolute",
    "alignment": "center",
    "ranges": [
        5,
        7.5,
        10
    ]
};
var filterJson = {
    "cheater": false
};
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
var isReady = false;
var extraJson = {};
var teamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.findOrCreateLobby(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "FIND_OR_CREATE_LOBBY",
    "data": {
        "lobbyType": "4v4",
        "rating": 76,
        "maxSteps": 3,
        "algo": {
            "strategy": "ranged-absolute",
            "alignment": "center",
            "ranges": [
                5,
                7.5,
                10
            ]
        },
        "filterJson": {
            "cheater": false
        },
        "otherUserCxIds": [
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "isReady": false,
        "extraJson": {},
        "teamCode": "blue"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {
        "entryId": "7483a8-a27"
    }
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/2_capi/lobby/findorcreatelobbywithpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/findorcreatelobbywithpingdata -->

# FindOrCreateLobbyWithPingData

Adds the caller to the lobby entry queue and will create a lobby if none are found.

Use [PingRegions](/api/capi/lobby/pingregions) to generate the ping data.

| Service | Operation |
| ------- | --------- |
| lobby | FIND_OR_CREATE_LOBBY_WITH_PING_DATA |

## Method Parameters

| Parameter      | Description                                                                                                                                                                                            |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| lobbyType      | The type of lobby to look for. Lobby types are defined in the portal.                                                                                                                                  |
| rating         | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).                   |
| maxSteps       | The maximum number of steps to wait when looking for an applicable lobby. Each step is ~5 seconds.                                                                                                     |
| algo           | The algorithm to use for increasing the search scope.                                                                                                                                                  |
| filterJson     | Used to help filter the list of rooms to consider. Passed to the matchmaking filter, if configured.                                                                                                    |
| otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.                                        |
| settings       | Owner settings for the lobby.                                                                                                                                                                          |
| 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

**C#:**

```csharp
string lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
string algo = "{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
string filterJson = "{\"cheater\":false}";
string[] otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" };
string settings = "{}";
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.FindOrCreateLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
const char *algo = "{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
const char *filterJson = "{\"cheater\":false}";
std::vector<std::string> otherUserCxIds;
otherUserCxIds.push_back("123456:aaa-bbb-ccc-ddd:asdfjkl");
const char *settings = "{}";
bool isReady = false;
const char *extraJson = "{}";
const char *teamCode = "blue";
_bc->getLobbyService()->findOrCreateLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"4v4";
int rating = 76;
int maxSteps = 3;
NSString *algo = @"{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
NSString *filterJson = @"{\"cheater\":false}";
NSArray *otherUserCxIds = @[ @"123456:aaa-bbb-ccc-ddd:asdfjkl" ];
NSString *settings = @"{}";
bool isReady = false;
NSString *extraJson = @"{}";
NSString *teamCode = @"blue";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] findOrCreateLobbyWithPingData:lobbyType
                     rating:rating
                   maxSteps:maxSteps
                       algo:algo
                 filterJson:filterJson
             otherUserCxIds:otherUserCxIds
                   settings:settings
                    isReady:isReady
                  extraJson:extraJson
                   teamCode:teamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "4v4";
int rating = 76;
int maxSteps = 3;
String algo = "{\"strategy\": \"compound\",\"algos\": [{ \"criteria\": \"ping\", \"strategy\": \"absolute\", \"alignment\": \"absolute\" },{ \"criteria\": \"rating\", \"strategy\": \"ranged-absolute\", \"alignment\": \"center\" }],\"compound-ranges\": [[ 30, [ 5, 10 ]],[ 50, [ 10, 15 ]]]}";
String filterJson = "{\"cheater\":false}";
String[] otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" };
String settings = "{}";
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().findOrCreateLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
};
var filterJson = {
    "cheater": false
};
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
var isReady = false;
var extraJson = {};
var teamCode = "blue";

_bc.lobby.findOrCreateLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "4v4";
var  rating = 76;
var  maxSteps = 3;
var  algo = {
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
};
var  filterJson = {
    "cheater": false
};
var  otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var  settings = {};
var  isReady = false;
var  extraJson = {};
var  teamCode = "blue";

ServerResponse result = await _bc.lobbyService.findOrCreateLobbyWithPingData(lobbyType:lobbyType, rating:rating, maxSteps:maxSteps, algo:algo, filterJson:filterJson, otherUserCxIds:otherUserCxIds, settings:settings, isReady:isReady, extraJson:extraJson, teamCode:teamCode);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "compound",
    algos = {
        { criteria = "ping", strategy = "absolute", alignment = "absolute" },
        {
            criteria = "rating",
            strategy = "ranged-absolute",
            alignment = "center"
        }
    },
    ["compound-ranges"] = { {30, {5, 10 }},
        { 50, {10, 15 }}
    }
}
local filterJson = {
    cheater = false
}
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }
local settings = {}
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findOrCreateLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, callback)
```

**GDScript:**

```gdscript
var lobby_type = "4v4"
var rating = 76
var max_steps = 3
var algo = {
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
}
var filter_json = {
    "cheater": false
}
var other_user_cx_ids = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ]
var settings = {}
var is_ready = false
var extra_json = {}
var team_code = "blue"

var result = await _bc.lobby_service.find_or_create_lobby_with_ping_data(lobby_type, rating, max_steps, algo, filter_json, settings, is_ready, extra_json, team_code, other_user_cx_ids)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyType = "4v4"
local rating = 76
local maxSteps = 3
local algo = {
    strategy = "compound",
    algos = {
        {
            criteria = "ping",
            strategy = "absolute",
            alignment = "absolute"
        },
        {
            criteria = "rating",
            strategy = "ranged-absolute",
            alignment = "center"
        }
    },
    ["compound-ranges"] = { { 30, { 5, 10 } }, { 50, { 10, 15 } } }
}
local filterJson = { cheater = false }
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }
local settings = {}
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:findOrCreateLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "4v4";
var rating = 76;
var maxSteps = 3;
var algo = {
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
};
var filterJson = {
    "cheater": false
};
var otherUserCxIds = [ "123456:aaa-bbb-ccc-ddd:asdfjkl" ];
var settings = {};
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.findOrCreateLobbyWithPingData(lobbyType, rating, maxSteps, algo, filterJson, otherUserCxIds, settings, isReady, extraJson, teamCode, pingData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "FIND_OR_CREATE_LOBBY_WITH_PING_DATA",
    "data": {
        "lobbyType": "4v4",
        "rating": 76,
        "maxSteps": 3,
        "algo": {
            "strategy": "compound",
            "algos": [
                { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
                {
                    "criteria": "rating",
                    "strategy": "ranged-absolute",
                    "alignment": "center"
                }
            ],
            "compound-ranges": [
                [30, [5, 10]],
                [50, [10, 15]]
            ]
        },
        "filterJson": {
            "cheater": false
        },
        "otherUserCxIds": [
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "settings": {},
        "isReady": false,
        "extraJson": {},
        "teamCode": "blue",
        "pingData": {
            "ca-central-1": 98,
            "us-west-1": 123
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {
        "entryId": "7483a8-a27"
    }
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/getlobbydata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/getlobbydata -->

# GetLobbyData

Returns the data for the specified lobby, including member data.

| Service | Operation |
| ------- | --------- |
| lobby | GET_LOBBY_DATA |

## Method Parameters

| Parameter | Description         |
| --------- | ------------------- |
| lobbyId   | Id of chosen lobby. |

## Usage

**C#:**

```csharp
string lobbyId = "13229:Relay_lobbyT_v2:20";
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.GetLobbyData(lobbyId, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "13229:Relay_lobbyT_v2:20";
_bc->getLobbyService()->getLobbyData(lobbyId, this);
```

**Obj-C:**

```objectivec
NSString *lobbyId = @"13229:Relay_lobbyT_v2:20";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] getLobbyData:lobbyId
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "13229:Relay_lobbyT_v2:20";
this; // implements IServerCallback

_bc.getLobbyService().getLobbyData(lobbyId, 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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "13229:Relay_lobbyT_v2:20";

_bc.lobby.getLobbyData(lobbyId, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "13229:Relay_lobbyT_v2:20";

ServerResponse result = await _bc.lobbyService.getLobbyData(lobbyId:lobbyId);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyId = "13229:Relay_lobbyT_v2:20"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getLobbyData(lobbyId, callback)
```

**GDScript:**

```gdscript
var lobby_id = "13229:Relay_lobbyT_v2:20"

var result = await _bc.lobby_service.get_lobby_data(lobby_id)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "13229:Relay_lobbyT_v2:20"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getLobbyData(lobbyId, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "13229:Relay_lobbyT_v2:20";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.getLobbyData(lobbyId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "GET_LOBBY_DATA",
    "data": {
        "lobbyId": "13229:Relay_lobbyT_v2:20"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "id": "13229:Relay_lobbyT_v2:20",
        "lobbyType": "Relay_lobbyT_v2",
        "state": "setup",
        "rating": 0,
        "lobbyTypeDef": {
            "lobbyTypeId": "Relay_lobbyT_v2",
            "teams": {
                "all": {
                    "minUsers": 1,
                    "maxUsers": 8,
                    "autoAssign": true,
                    "code": "all"
                }
            },
            "rules": {
                "allowEarlyStartWithoutMax": true,
                "forceOnTimeStartWithoutReady": true,
                "allowJoinInProgress": false,
                "onTimeStartSecs": 600,
                "disbandOnStart": true,
                "everyReadyMinPercent": 15,
                "everyReadyMinNum": 1,
                "earliestStartSecs": 1,
                "tooLateSecs": 600
            },
            "desc": "starts when 1 player is ready"
        },
        "settings": {},
        "version": 1,
        "connectData": {},
        "timetable": {
            "createdAt": 1631050042177,
            "early": 1631050043177,
            "onTime": 1631050642177,
            "tooLate": 1631050642177
        },
        "cRegions": [],
        "round": 1,
        "ownerCxId": "13229:db4be46d-1e99-41fe-9402-a0e8f7cd7cb5:p57kebat767ogdtesnp5cmd46p",
        "legacyLobbyOwnerEnabled": true,
        "owner": "db4be46d-1e99-41fe-9402-a0e8f7cd7cb5",
        "numMembers": 1,
        "members": [
            {
                "profileId": "db4be46d-1e99-41fe-9402-a0e8f7cd7cb5",
                "name": "",
                "pic": "",
                "rating": 1200,
                "team": "all",
                "isReady": true,
                "extra": {},
                "cxId": "13229:db4be46d-1e99-41fe-9402-a0e8f7cd7cb5:p57kebat767ogdtesnp5cmd46p"
            }
        ]
    },
    "status": 200
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                                            |
| ----- | --------------- | ------------------------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature                   |
| 40613 | LOBBY_NOT_FOUND | Unrecognized lobby, the specified lobby does not exist |

</details>


---

<!-- source: docs/api/2_capi/lobby/getlobbyinstances.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/getlobbyinstances -->

# GetLobbyInstances

Gets a map keyed by rating of the visible lobby instances matching the given type and rating range.

| Service | Operation |
| ------- | --------- |
| lobby | GET_LOBBY_INSTANCES |

## Method Parameters

| Parameter    | Description                                                                         |
| ------------ | ----------------------------------------------------------------------------------- |
| lobbyType    | The type of lobby to look for. Lobby types are defined in the portal.               |
| criteriaJson | JSON object describing the filter criteria. Supported sub-values include: 'rating'. |

## Usage

**C#:**

```csharp
string lobbyType = "Relay_lobbyT_v2";
Dictionary<string, object> criteriaJson = new Dictionary<string, object>
{
  { "rating", new Dictionary<string, object>
      {
        { "min", 10 },
        { "max", 100 }
      }
  }
};

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.GetLobbyInstances(lobbyType, criteriaJson, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "Relay_lobbyT_v2";
const char *criteriaJson = "{\"rating\":{\"min\":10,\"max\":100}}";

_bc->getLobbyService()->getLobbyInstances(lobbyType, criteriaJson, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"Relay_lobbyT_v2";
NSString *criteriaJson = @"{\"rating\":{\"min\":10,\"max\":100}}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] getLobbyInstances:lobbyType
               criteriaJson:criteriaJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "Relay_lobbyT_v2";
String criteriaJson = "{\"rating\":{\"min\":10,\"max\":100}}";

this; // implements IServerCallback

_bc.getLobbyService().getLobbyInstances(lobbyType, criteriaJson, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "Relay_lobbyT_v2";
var "criteriaJson" = {
      "rating": {
        "min": 10,
        "max": 100
      }
    };

_bc.lobby.getLobbyInstances(lobbyType, criteriaJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "Relay_lobbyT_v2";
var  "criteriaJson" = {
      "rating": {
        "min": 10,
        "max": 100
      }
    };

ServerResponse result = await _bc.lobbyService.getLobbyInstances(lobbyType:lobbyType, criteriaJson:criteriaJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyType = "Relay_lobbyT_v2"
local criteriaJson = { rating = { min = 10, max = 100 } }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getLobbyInstances(lobbyType, criteriaJson, callback)
```

**GDScript:**

```gdscript
var lobby_type = "Relay_lobbyT_v2"

var result = await _bc.lobby_service.get_lobby_instances(lobby_type, criteriaJson)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyType = "Relay_lobbyT_v2"
local criteriaJson = { rating = { min = 10, max = 100 } }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getLobbyInstances(lobbyType, criteriaJson, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "Relay_lobbyT_v2";
var criteriaJson = {
      "rating": {
        "min": 10,
        "max": 100
      }
    };
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.getLobbyInstances(lobbyType, criteriaJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "GET_LOBBY_INSTANCES",
    "data": {
        "lobbyType": "Relay_lobbyT_v2",
    "criteriaJson": {
      "rating": {
        "min": 10,
        "max": 100
      }
    }
    }
}
```

> **Tip:** If the "settings" parameter is specified during the creation of a lobby, as demonstrated below:
> 
> ```json
> {
>     "_public": {
>         "name": "myLobbyName",
>         "pwd": "mySecretCode"
>     }
> }
> ```
> 
> A new field named "publicSettings" will be returned in the response.
> 
> ````json
> {
>   "publicSettings": {
>       "name": "myLobbyName",
>       "pwd": "mySecretCode"
>   }
> }

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "lobbiesByRating": {
            "20.0": [
                {
                    "id": "23782:Relay_lobbyT_v2:2",
                    "lobbyType": "Relay_lobbyT_v2",
                    "state": "setup",
                    "rating": 20,
                    "desc": "starts as soon as 1 player is ready",
                    "owner": {
                        "profileId": "10b6d6fa-0aa6-43b0-a7b3-48aff2d13312",
                        "name": "",
                        "rating": 0,
                        "pic": null,
                        "cxId": "23782:10b6d6fa-0aa6-43b0-a7b3-48aff2d13312:52kc0h19k0pnnjhnrp8pug7udd"
                    },
                    "numMembers": 1,
                    "maxMembers": 8,
                    "publicSettings": {
                        "name": "myLobbyName",
                        "pwd": "mySecretCode"
                    }
                }
            ]
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/getlobbyinstanceswithpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/getlobbyinstanceswithpingdata -->

# GetLobbyInstancesWithPingData

Gets a map keyed by rating of the lobby instances matching the given type, rating range, and ping threshold.

| Service | Operation |
| ------- | --------- |
| lobby | GET_LOBBY_INSTANCES_WITH_PING_DATA |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyType | The type of lobby to look for. Lobby types are defined in the portal.
criteriaJson | JSON object describing the filter criteria. Supported sub-values include: 'rating'.
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

**C#:**

```csharp
string lobbyType = "Relay_lobbyT_v2";
Dictionary<string, object> criteriaJson = new Dictionary<string, object>
{
  { "rating", new Dictionary<string, object>
      {
        { "min", 10 },
        { "max", 100 }
      }
  },
    { "ping", new Dictionary<string, object>
      {
        { "max", 200 }
      }
  }
};

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.GetLobbyInstancesWithPingData(lobbyType, criteriaJson, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyType = "Relay_lobbyT_v2";
const char *criteriaJson = "{\"rating\":{\"min\":10,\"max\":100},\"ping\":{\"max\":200}}";

_bc->getLobbyService()->getLobbyInstancesWithPingData(lobbyType, criteriaJson, this);
```

**Obj-C:**

```objectivec
NSString *lobbyType = @"Relay_lobbyT_v2";
NSString *criteriaJson = @"{\"rating\":{\"min\":10,\"max\":100},\"ping\":{\"max\":200}}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] getLobbyInstancesWithPingData:lobbyType
               criteriaJson:criteriaJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyType = "Relay_lobbyT_v2";
String criteriaJson = "{\"rating\":{\"min\":10,\"max\":100},\"ping\":{\"max\":200}}";
this; // implements IServerCallback

_bc.getLobbyService().getLobbyInstancesWithPingData(lobbyType, criteriaJson, 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()));
}
```

**JavaScript:**

```javascript
var lobbyType = "Relay_lobbyT_v2";
var "criteriaJson" = {
      "rating": {
        "min": 10,
        "max": 100
      },
      "ping", {
        "max": 200
      }
    };

_bc.lobby.getLobbyInstancesWithPingData(lobbyType, criteriaJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyType = "Relay_lobbyT_v2";
var  "criteriaJson" = {
      "rating": {
        "min": 10,
        "max": 100
      },
      "ping", {
        "max": 200
      }
    };

ServerResponse result = await _bc.lobbyService.getLobbyInstancesWithPingData(lobbyType:lobbyType, criteriaJson:criteriaJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyType = "Relay_lobbyT_v2"
local criteriaJson = {
    rating = { min = 10, max = 100 },
    ping = { max = 200 }
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getLobbyInstancesWithPingData(lobbyType, criteriaJson, callback)
```

**GDScript:**

```gdscript
var lobby_type = "Relay_lobbyT_v2"

var result = await _bc.lobby_service.get_lobby_instances_with_ping_data(lobby_type, criteriaJson)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyType = "Relay_lobbyT_v2"
local criteriaJson = {
    rating = { min = 10, max = 100 },
    ping = { max = 200 }
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getLobbyInstancesWithPingData(lobbyType, criteriaJson, callback)
```

**Cloud Code:**

```cfscript
var lobbyType = "Relay_lobbyT_v2";
var criteriaJson = {
      "rating": {
        "min": 10,
        "max": 100
      },
      "ping", {
        "max": 200
      }
    };
var pingData = {
      "ca-central-1": 112,
      "us-west-1": 67
    };
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.getLobbyInstancesWithPingData(lobbyType, criteriaJson, pingData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "GET_LOBBY_INSTANCES_WITH_PING_DATA",
    "data": {
        "lobbyType": "Relay_lobbyT_v2",
    "criteriaJson": {
      "rating": {
        "min": 10,
        "max": 100
      },
      "ping": {
        "max": 200
      }
    },
    "pingData": {
      "ca-central-1": 112,
      "us-west-1": 67
    }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "lobbiesByRating": {
            "20.0": [
                {
                    "id": "23782:Relay_lobbyT_v2:2",
                    "lobbyType": "Relay_lobbyT_v2",
                    "state": "setup",
                    "rating": 20,
                    "desc": "starts as soon as 1 player is ready",
                    "owner": {
                        "profileId": "10b6d6fa-0aa6-43b0-a7b3-48aff2d13312",
                        "name": "",
                        "rating": 0,
                        "pic": null,
                        "cxId": "23782:10b6d6fa-0aa6-43b0-a7b3-48aff2d13312:52kc0h19k0pnnjhnrp8pug7udd"
                    },
                    "numMembers": 1,
                    "maxMembers": 8
                }
            ]
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/lobby/getregionsforlobbies.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/getregionsforlobbies -->

# GetRegionsForLobbies

Retrieves the region settings for each of the given lobby types.

| Service | Operation |
| ------- | --------- |
| lobby | GET_REGIONS_FOR_LOBBIES |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyTypes | Types of lobby being queried. 

## Usage

**C#:**

```csharp
string[] lobbyTypes = { "2v2", "4v4" };
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.GetRegionsForLobbies(lobbyTypes, successCallback, failureCallback);
```

**C++:**

```cpp
std::vector<std::string> lobbyTypes;
lobbyTypes.push_back("2v2");
lobbyTypes.push_back("4v4");
_bc->getLobbyService()->getRegionsForLobbies(lobbyTypes, this);
```

**Obj-C:**

```objectivec
NSArray *lobbyTypes = @[ @"2v2", @"4v4" ];
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] getRegionsForLobbies:lobbyTypes
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String[] lobbyTypes = { "2v2", "4v4" };
this; // implements IServerCallback

_bc.getLobbyService().getRegionsForLobbies(lobbyTypes, 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()));
}
```

**JavaScript:**

```javascript
var lobbyTypes = [ "2v2", "4v4" ];

_bc.lobby.getRegionsForLobbies(lobbyTypes, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyTypes = [ "2v2", "4v4" ];

ServerResponse result = await _bc.lobbyService.getRegionsForLobbies(lobbyTypes:lobbyTypes);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyTypes = { "2v2", "4v4" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getRegionsForLobbies(lobbyTypes, callback)
```

**GDScript:**

```gdscript
var lobby_types = [ "2v2", "4v4" ]

var result = await _bc.lobby_service.get_regions_for_lobbies(lobby_types)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyTypes = { "2v2", "4v4" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:getRegionsForLobbies(lobbyTypes, callback)
```

**Cloud Code:**

```cfscript
var lobbyTypes = [ "2v2", "4v4" ];
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.getRegionsForLobbies(lobbyTypes);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "GET_REGIONS_FOR_LOBBIES",
    "data": {
        "lobbyTypes": [
            "2v2",
            "4v4"
        ]
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "lobbyTypeRegions": {
            "Relay_lobbyT_v2": [
                "ca-central-1"
            ]
        },
        "regionPingData": {
            "ca-central-1": {
                "type": "PING",
                "target": "dynamodb.ca-central-1.amazonaws.com"
            }
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/lobby/index.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby -->

# Lobby

The **Lobby Service** works together with custom **Room Servers** to provide multi-user experiences (i.e. online games, shared streaming, etc.) to groups of participants.

It is available to apps that have **brainCloud RTT** enabled.

> **Info:** You configure <em>Lobby Types</em> in the portal under <strong>Design | Multiplayer | Lobbies</strong>.

### Key concepts

![Online Multiplayer Process](@site/docs/img/api-img/online_multiplayer_process.png)

_Lobbies_ are used to gather up users prior to launching shared experiences via _Room Servers_. Users can be added to teams, indicate their ready status, and adjust personal and room settings before the experience starts.

The _Lobby Service_ also offers highly configurable _Online Matchmaking_ - to quickly and efficiently pair users up together.

_For more information on Lobby Concepts, see the [Lobby Overview](/learn/key-concepts/multiplayer/lobbies/) page._

### API Summary

> `DISBANDED` event example

```json
{
    "service": "lobby",
    "operation": "DISBANDED",
    "data": {
        "lobbyId": "22819:unranked:406",
        "reason": {
            "code": 80101,
            "desc": "Room successfully launched"
        }
    }
}
```

> `JOIN_FAIL` event example

```json
{
    "service": "lobby",
    "operation": "JOIN_FAIL",
    "data": {
        "lobbyType": "4v4",
        "reason": {
            "code": 80200,
            "desc": "No lobbies found matching criteria"
        }
    }
}
```

> `MEMBER_JOIN` event example

```json
{
    "service": "lobby",
    "operation": "MEMBER_JOIN",
    "data": {
        "lobbyId": "13469:CustomGame:11",
        "currentTime": 1747412422839,
        "lobby": {
            "state": "setup",
            "rating": 0,
            "ownerCxId": "13469:48844593-6e01-464f-bc13-565ee536a46b:1kslkorpivpa68bhf21q1avi9q",
            "lobbyTypeDef": {
                "roomConfig": null,
                "lobbyTypeId": "CustomGame",
                "teams": {
                    "all": {
                        "minUsers": 1,
                        "maxUsers": 8,
                        "autoAssign": true,
                        "code": "all"
                    }
                },
                "rules": {
                    "allowEarlyStartWithoutMax": false,
                    "forceOnTimeStartWithoutReady": true,
                    "allowJoinInProgress": false,
                    "onTimeStartSecs": 1,
                    "disbandOnStart": true,
                    "everyReadyMinPercent": 50,
                    "everyReadyMinNum": 1,
                    "earliestStartSecs": 1,
                    "tooLateSecs": 300
                },
                "desc": "for example -- custom multiplayer server with unity"
            },
            "settings": {},
            "version": 1,
            "timetable": {
                "createdAt": 1747412422839,
                "early": 1747412423839,
                "onTime": 1747412423839,
                "tooLate": 1747412722839,
                "dropDead": 1747413322839,
                "ignoreDropDeadUntil": 0
            },
            "cRegions": [],
            "round": 1,
            "isRoomReady": false,
            "keepAliveRateSeconds": 0,
            "isAvailable": true,
            "shardId": 0,
            "legacyLobbyOwnerEnabled": true,
            "owner": "48844593-6e01-464f-bc13-565ee536a46b",
            "numMembers": 1,
            "members": [
                {
                    "profileId": "48844593-6e01-464f-bc13-565ee536a46b",
                    "name": "",
                    "pic": "",
                    "rating": 0,
                    "team": "all",
                    "isReady": true,
                    "extra": {},
                    "ipAddress": "174.112.74.185",
                    "cxId": "13469:48844593-6e01-464f-bc13-565ee536a46b:1kslkorpivpa68bhf21q1avi9q"
                }
            ]
        },
        "member": {
            "profileId": "48844593-6e01-464f-bc13-565ee536a46b",
            "name": "",
            "pic": "",
            "rating": 0,
            "team": "all",
            "isReady": true,
            "extra": {},
            "ipAddress": "174.112.74.185",
            "cxId": "13469:48844593-6e01-464f-bc13-565ee536a46b:1kslkorpivpa68bhf21q1avi9q"
        }
    }
}
```

> `MEMBER_LEFT` event example

```json
{
    "service": "lobby",
    "operation": "MEMBER_LEFT",
    "data": {
        "lobbyId": "22979:4v4:1387",
        "lobby": {
            "owner": "d8297230-6e7b-4bad-9c66-5371eb5c101b",
            "version": 1,
            "numMembers": 1,
            "members": []
        },
        "member": {
            "profileId": "24da7a7a-8e78-45a2-8350-30ad41c5372b",
            "name": "Daivuk",
            "pic": "",
            "rating": 0,
            "team": "green",
            "isReady": false,
            "extra": {
                "loadout": "tank"
            },
            "cxId": "22979:24da7a7a-8e78-45a2-8350-30ad41c5372b:a4nto6vb672qtq1rpa1pecba48"
        },
        "reason": {
            "code": 80000,
            "desc": "Left by choice"
        }
    }
}
```

> `MEMBER_UPDATE` event example

```json
{
    "service": "lobby",
    "operation": "MEMBER_UPDATE",
    "data": {
        "lobbyId": "22979:4v4:662",
        "member": {
            "profileId": "841cf9fa-1a93-4a7a-a36b-e5833f7e239b",
            "name": "ste123",
            "pic": "",
            "rating": 0,
            "team": "red",
            "isReady": true,
            "extra": {
                "loadout": "scout"
            },
            "cxId": "22979:841cf9fa-1a93-4a7a-a36b-e5833f7e239b:acturqk5p5qaenvio8msecob9d"
        }
    }
}
```

> `ROOM_ASSIGNED` event example

```json
{
    "service": "lobby",
    "operation": "ROOM_ASSIGNED",
    "data": {
        "lobbyId": "22819:unranked:406",
        "connectData": {
            "roomId": "22819:unranked:406",
            "url": "207.219.200.99",
            "port": 9307,
            "wsPort": 9308
        },
        "passcode": "978b63"
    }
}
```

> `ROOM_READY` event example

```json
{
    "service": "lobby",
    "operation": "ROOM_READY",
    "data": {
        "lobbyId": "22819:unranked:406",
        "connectData": {
            "roomId": "22819:unranked:406",
            "url": "207.219.200.99",
            "port": 9307,
            "wsPort": 9308
        },
        "passcode": "978b63"
    }
}
```

> `SETTINGS_UPDATE` event example

```json
{
    "service": "lobby",
    "operation": "SETTINGS_UPDATE",
    "data": {
        "lobbyId": "22979:4v4:662",
        "lobby": {
            "settings": {
                "gameTime": 300
            },
            "version": 1
        },
        "currentTime": 1549916254804
    }
}
```

> `STARTING` event example

```json
{
    "service": "lobby",
    "operation": "STARTING",
    "data": {
        "lobbyId": "22819:unranked:406",
        "lobby": {
            "state": "starting",
            "owner": "f6fa3e0e-6aac-497a-84e1-c8db6f545c12",
            "settings": {},
            "version": 1,
            "numMembers": 1,
            "members": [
                {
                    "profileId": "48844593-6e01-464f-bc13-565ee536a46b",
                    "name": "",
                    "pic": "",
                    "rating": 0,
                    "team": "all",
                    "isReady": true,
                    "extra": {},
                    "ipAddress": "174.112.74.185",
                    "cxId": "13469:48844593-6e01-464f-bc13-565ee536a46b:1kslkorpivpa68bhf21q1avi9q"
                }
            ]
        }
    }
}
```

> `STATUS_UPDATE` event example

```json
{
    "service": "lobby",
    "operation": "STATUS_UPDATE",
    "data": {
        "lobbyId": "22819:unranked:406",
        "lobby": {
            "state": "early",
            "owner": "f6fa3e0e-6aac-497a-84e1-c8db6f545c12",
            "version": 1,
            "numMembers": 1,
            "members": [
                {
                    "profileId": "48844593-6e01-464f-bc13-565ee536a46b",
                    "name": "",
                    "pic": "",
                    "rating": 0,
                    "team": "all",
                    "isReady": true,
                    "extra": {},
                    "ipAddress": "174.112.74.185",
                    "cxId": "13469:48844593-6e01-464f-bc13-565ee536a46b:1kslkorpivpa68bhf21q1avi9q"
                }
            ]
        }
    }
}
```

> `ROOM_PROGRESS` event example

```json
{
    {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 1,
      "ofStep": 5,
      "msg": "Host lookup",
      "variation": "no-host-found"
    }
  },
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 2,
      "ofStep": 5,
      "msg": "New host started"
    }
  },
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 3,
      "ofStep": 5,
      "msg": "Host docker init"
    }
  },
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 4,
      "ofStep": 5,
      "msg": "Pulling container image"
    }
  },
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 5,
      "ofStep": 5,
      "msg": "Starting container"
    }
  }
}
```

The Lobby Service provides APIs for _Online Matchmaking_, _Lobby Experience_ and _Room Server Integration_.

### Online Matchmaking

The _Online Matchmaking_ APIs allow users to find and/or create lobbies:

-   [FindLobby](/api/capi/lobby/findlobby) - Find a lobby to meet the provided specs.
-   [CreateLobby](/api/capi/lobby/createlobby) - Create a lobby.
-   [FindOrCreateLobby](/api/capi/lobby/findorcreatelobby) - Search for lobby; create one if nothing suitable is found.
-   [JoinLobby](/api/capi/lobby/joinlobby) - Adds the caller to the given lobby instance.

-   [GetRegionsForLobbies](/api/capi/lobby/getregionsforlobbies) - Retrieves the region settings for each of the given lobby types.
-   [PingRegions](/api/capi/lobby/pingregions) - Retrieves associated PingData averages to be used with all associated WithPingData APIs.

-   [FindLobbyWithPingData](/api/capi/lobby/findlobbywithpingdata) - Adds the caller to the lobby entry queue.
-   [FindOrCreateLobbyPingData](/api/capi/lobby/createlobbywithpingdata) - Creates an instance of a lobby.
-   [FindOrCreateLobbyWithPingData](/api/capi/lobby/findorcreatelobbywithpingdata) - Adds the caller to the lobby entry queue and will create a lobby if none are found.
-   [JoinLobbyWithPingData](/api/capi/lobby/joinlobbywithpingdata) - Adds the caller to the given lobby instance.

### Lobby Experience

The following APIs allow users to interact with lobby's once they have joined:

-   [GetLobbyData](/api/capi/lobby/getlobbydata) - request info about the lobby
-   [UpdateReady](/api/capi/lobby/updateready) - update the user's ready-status
-   [UpdateSettings](/api/capi/lobby/updatesettings) - update the lobby's setting data (owner only)
-   [SwitchTeam](/api/capi/lobby/switchteam) - switch teams
-   [SendSignal](/api/capi/lobby/sendsignal) - send an event to all other lobby members
-   [LeaveLobby](/api/capi/lobby/leavelobby) - leave the lobby
-   [RemoveMember](/api/capi/lobby/removemember) - kicks another member from the lobby

### Room Service Integration

The following APIs are called by Room Service providers:

-   [SysRoomReady](/api/capi/lobby/sysroomready) - the room experience is ready to launch
-   [SysRoomCancelled](/api/capi/lobby/sysroomcancelled) - the room server request cannot be fulfilled

### Lobby Events

These APIs can result in the following events being sent to lobby members.

| Event                   | Data                                                            | Description                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MATCHMAKING_IN_PROGRESS | lobbyType, step, maxSteps, minRating, maxRating, lobbiesInRange | Start provisioning lobby. Sent to everyone as they are being processed for each marchmaking round.                                                                                                                                                                                                                                                                    |
| MEMBER_JOIN             | lobbyId, currentTime, lobby, memeber                            | A new member has joined the lobby. Sent to everyone, including the user who joined.                                                                                                                                                                                                                                                                                   |
| JOIN_FAIL               | lobbyType, reason                                               | Could not locate a lobby that satisfies the filter criteria in the specified timeframe. The returned `reason` is mapped with `code` (including `NO_LOBBIES_FOUND`, `FIND_REQUEST_CANCELLED`) and `desc`.                                                                                                                                                              |
| MEMBER_LEFT             | lobbyId, lobby, member, reason                                  | A member has left the lobby. Sent to everyone, including the user who left. The returned `reason` is mapped with `code` (including `LEFT_BY_CHOICE`, `EVICTED`, `LOST_CONNECTION`) and `desc`.                                                                                                                                                                        |
| MEMBER_UPDATE           | lobbyId, lobby, member                                          | A member has updated their data, which may include switching teams, thus why all of lobbyData is returned.                                                                                                                                                                                                                                                            |
| SIGNAL                  | lobbyId, from (optional), signalData                            | This message allows players in lobbies to send messages to all other players.                                                                                                                                                                                                                                                                                         |
| SETTINGS_UPDATE         | lobbyId, currentTime, lobby                                     | Changes to the settings that will be used to start the room.                                                                                                                                                                                                                                                                                                          |
| STATUS_UPDATE           | lobbyId, lobby                                                  | The status of the overall lobby has changed.                                                                                                                                                                                                                                                                                                                          |
| STARTING                | lobbyId, lobby                                                  | This message is sent once all the hosted server launch conditions have been met and a server instance is being started.                                                                                                                                                                                                                                               |
| ROOM_PROGRESS           | lobbyId, curStep, ofStep, msg                                   | The configurable Room-Progress messages are transmitted between the events of `STARTING` and `ROOM_READY`, serving to indicate the progress of the provisioning of the room server. In the case of a new host being initiated, there are a total of 5 progress steps, whereas if this is not the case, there are 4 steps. See the following example for more details. |
| ROOM_ASSIGNED           | lobbyId, connectData, passcode                                  | A room has been allocated for this lobby. `connectData` is likely incompolete. Each lobby member receives a random alphanumeric passcode for use in connecting to the room server to guard against impersonation.                                                                                                                                                     |
| ROOM_READY              | lobbyId, connectData, passcode                                  | Go connect to the specified room. Will normally be immediately followed by DISBANDED. The same passcode as sent in ROOM_ASSIGNED will be repeated here as well.                                                                                                                                                                                                       |
| DISBANDED               | lobbyId, reason, msg (optional)                                 | The lobby has been terminated. The returned `reason` is mapped with `code` (including `TIMEOUT`, `ROOM_READY`, `ROOM_READY_TIMEOUT`, `ROOM_CANCELLED`, `ERROR_ASSIGNING_ROOM`, `ERROR_LAUNCHING_ROOM`, `HOSTING_NOT_ENABLED`, `SERVER_MAX_REACHED`, `BY_REQUEST`) and `desc`.                                                                                         |

An example of using the returned `reason code` of DISBANDED:

```
if (result.data.reason.code != this.bc.reasonCodes.RTT_ROOM_READY)
{
    // Disbanded for any other reason than ROOM_READY, means we failed to launch the game.
    this.onGameScreenClose()
}
```

An example of ROOM_PROGRESS messages when a host is found:

```json
{
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 1,
      "ofStep": 4,
      "msg": "Host lookup",
      "variation": "host-found"
    }
  },
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 2,
      "ofStep": 4,
      "msg": "Host docker init"
    }
  },
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 3,
      "ofStep": 4,
      "msg": "Pulling container image"
    }
  },
  {
    "service": "lobby",
    "operation": "ROOM_PROGRESS",
    "data": {
      "lobbyId": "23649:CursorPartyV2:4186",
      "curStep": 4,
      "ofStep": 4,
      "msg": "Starting container"
    }
  }
}
```

```json
// an example of the "progress" events being sent out to lobby members
{"service":"lobby","operation":"STARTING","data":{"lobbyId":"23649:CursorPartyV2:4186","lobby":{"state":"starting","settings":{},"version":1,"cRegions":[],"round":1,"isRoomReady":false,"keepAliveRateSeconds":72,"isAvailable":true,"ownerCxId":"23649:37e60799-468d-4440-8fce-5d8eabade18d:4s26gha7bhmiottrn3v38d8l0o","legacyLobbyOwnerEnabled":false,"numMembers":1,"members":[{"profileId":"37e60799-468d-4440-8fce-5d8eabade18d","name":"greg@bitheads.com","pic":"","rating":0,"team":"all","isReady":true,"extra":{"colorIndex":6,"presentSinceStart":false},"ipAddress":"184.148.127.43","cxId":"23649:37e60799-468d-4440-8fce-5d8eabade18d:4s26gha7bhmiottrn3v38d8l0o"}]}}}
{"service":"lobby","operation":"ROOM_PROGRESS","data":{"lobbyId":"23649:CursorPartyV2:4186","curStep":1,"ofStep":5,"msg":"Host lookup","variation":"no-host-found"}}
{"service":"lobby","operation":"ROOM_PROGRESS","data":{"lobbyId":"23649:CursorPartyV2:4186","curStep":2,"ofStep":5,"msg":"New host started"}}
{"service":"lobby","operation":"ROOM_PROGRESS","data":{"lobbyId":"23649:CursorPartyV2:4186","curStep":3,"ofStep":5,"msg":"Host docker init"}}
{"service":"lobby","operation":"ROOM_ASSIGNED","data":{"lobbyId":"23649:CursorPartyV2:4186","connectData":{"address":"3.96.222.126","ports":{"udp":9000,"tcp":9000,"ws":9001}},"passcode":"fda606"}}
{"service":"lobby","operation":"ROOM_PROGRESS","data":{"lobbyId":"23649:CursorPartyV2:4186","curStep":4,"ofStep":5,"msg":"Pulling container image"}}
{"service":"lobby","operation":"ROOM_PROGRESS","data":{"lobbyId":"23649:CursorPartyV2:4186","curStep":5,"ofStep":5,"msg":"Starting container"}}
{"service":"lobby","operation":"ROOM_READY","data":{"lobbyId":"23649:CursorPartyV2:4186","connectData":{"address":"3.96.222.126","ports":{"udp":9000,"tcp":9000,"ws":9001}},"passcode":"fda606"}}
```

### Common Event Structures

The following structures are common to multiple event types:

### `lobbyTypeDef`

The configured meta-data for the lobby type:

```json
{
    "lobbyTypeDef": {
        "roomConfig": null,
        "lobbyTypeId": "unranked",
        "teams": {
            "player1": {
                "minUsers": 1,
                "maxUsers": 1,
                "autoAssign": true,
                "code": "player1"
            },
            "player2": {
                "minUsers": 1,
                "maxUsers": 1,
                "autoAssign": true,
                "code": "player2"
            }
        },
        "rules": {
            "allowEarlyStartWithoutMax": false,
            "forceOnTimeStartWithoutReady": true,
            "onTimeStartSecs": 90,
            "everyReadyMinPercent": 100,
            "everyReadyMinNum": 2,
            "earliestStartSecs": 0,
            "tooLateSecs": 180
        },
        "desc": "Unranked match"
    }
}
```

### `members`

The list of members in the lobby, and their status:

```json
{
    "members": [
        {
            "profileId": "f6fa3e0e-6aac-497a-84e1-c8db6f545c12",
            "name": "david",
            "pic": "",
            "rating": 0,
            "team": "player2",
            "isReady": true,
            "extra": {},
            "cxId": "22819:f6fa3e0e-6aac-497a-84e1-c8db6f545c12:vn0vnr7li5ll6t7gc0om18hksg"
        },
        {
            "profileId": "1dab1250-facb-419a-80cf-3d2de4e91e0b",
            "name": "david2",
            "pic": "",
            "rating": 0,
            "team": "player1",
            "isReady": true,
            "extra": {},
            "cxId": "22819:1dab1250-facb-419a-80cf-3d2de4e91e0b:bkr44a0ssbd0q3ae3r2i2refjh"
        }
    ]
}
```

### `settings`

The developer-defined, dynamic settings for this lobby instance:

```json
{
    "settings": {
        "gameTime": 300,
        "isPlaying": 0,
        "mapLayout": 0,
        "mapSize": 1,
        "gameName": "ste123's Room",
        "maxPlayers": 8,
        "lightPosition": 0,
        "minLevel": 0,
        "maxLevel": 50
    }
}
```

_The json above is just an example - it can be whatever the developer decides._

### Search Algorithms

When looking for a lobby.

### `ranged-percent`

Ranges provided are interpreted as percentages to be applied to the user's rating for matchmaking.

```json
{
    "algo": {
        "strategy": "ranged-percent",
        "alignment": "center",
        "ranges": [10, 20, 80]
    }
}
```

### `ranged-absolute`

Ranges provided are interpreted as absolute values to add/subtract from the user's rating when calculating the range for matchmaking

```json
{
    "algo": {
        "strategy": "ranged-absolute",
        "alignment": "center",
        "ranges": [5, 7.5, 10]
    }
}
```

### `compound`

The compound algorithm allows multiple criteria to be used as the matchmaking filter. This is the approach to use when doing geo-matchmaking using the `WithPingData()` calls.

```json
{
    "strategy": "compound",
    "algos": [
        { "criteria": "ping", "strategy": "absolute", "alignment": "absolute" },
        {
            "criteria": "rating",
            "strategy": "ranged-absolute",
            "alignment": "center"
        }
    ],
    "compound-ranges": [
        [30, [5, 10]],
        [50, [10, 15]]
    ]
}
```

In the example above, matchmaking will look for matches as follows:

-   step 1: matches in regions with < 30ms ping and lobby rating within +/- 5 of player's rating
-   step 2: matches in regions with < 30ms ping and lobby rating within +/- 5 of player's rating
-   step 3: matches in regions with < 50ms ping and lobby rating within +/- 10 of player's rating
-   step 4: matches in regions with < 50ms ping and lobby rating within +/- 15 of player's rating

### `alignment`

The following alignment options are available, and show how they would affect a range of +/- 10 range for a ranking of 80.

| Alignment | Min | Max | Description                                                                                                                                                         |
| --------- | --- | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| high      | 80  | 100 | Ensures that lobbies must have skill rating &gt;= to the candidate. Leaves the min equal to player rating, and adds 200% of the range to the max. |
| mid-high  | 75  | 95  | Subtracks 50% of the range for the min, and adds 150% of the range to the max. |
| center    | 70  | 90  | Centers the range around the candidate's rating. |
| mid-low   | 65  | 85  | Subtracts 150% of the range for the min, and adds 50% of the range to the max. |
| low       | 60  | 80  | Ensures that lobbies will have skill rating &lt;= to the candidate. Subtracts 200% of the range from the rating to calculate min, and leaves max as the player rating. |


---

<!-- source: docs/api/2_capi/lobby/joinlobby.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/joinlobby -->

# JoinLobby

Adds the caller to the given lobby instance.

| Service | Operation |
| ------- | --------- |
| lobby | JOIN_LOBBY |

## 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. 

## Usage

**C#:**

```csharp
string lobbyId = "55555:4v4:3";
string[] otherUserCxIds = { "55555: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.JoinLobby(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "55555:4v4:3";
std::vector<std::string> otherUserCxIds;
otherUserCxIds.push_back("55555:aaa-bbb-ccc-ddd:asdfjkl");
bool isReady = false;
const char *extraJson = "{}";
const char *teamCode = "blue";
_bc->getLobbyService()->joinLobby(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, this);
```

**Obj-C:**

```objectivec
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] joinLobby:lobbyId
             otherUserCxIds:otherUserCxIds
                    isReady:isReady
                  extraJson:extraJson
                   teamCode:teamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "55555:4v4:3";
String[] otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" };
boolean isReady = false;
String extraJson = "{}";
String teamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().joinLobby(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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "55555:4v4:3";
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";

_bc.lobby.joinLobby(lobbyId, otherUserCxIds, isReady, extraJson, teamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "55555:4v4:3";
var  otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var  isReady = false;
var  extraJson = {};
var  teamCode = "blue";

ServerResponse result = await _bc.lobbyService.joinLobby(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}");
}
```

**Roblox:**

```lua
local lobbyId = "55555:4v4:3"
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:joinLobby(lobbyId, isReady, extraJson, teamCode, otherUserCxIds, callback)
```

**GDScript:**

```gdscript
var lobby_id = "55555:4v4:3"
var other_user_cx_ids = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ]
var is_ready = false
var extra_json = {}
var team_code = "blue"

var result = await _bc.lobby_service.join_lobby(lobby_id, is_ready, extra_json, team_code, other_user_cx_ids)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "55555:4v4:3"
local isReady = false
local extraJson = {}
local teamCode = "blue"
local otherUserCxIds = { "55555:aaa-bbb-ccc-ddd:asdfjkl" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:joinLobby(lobbyId, isReady, extraJson, teamCode, otherUserCxIds, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:3";
var otherUserCxIds = [ "55555:aaa-bbb-ccc-ddd:asdfjkl" ];
var isReady = false;
var extraJson = {};
var teamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.joinLobby(lobbyId, otherUserCxIds, isReady, extraJson, teamCode);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "JOIN_LOBBY",
    "data": {
        "lobbyId": "55555:4v4:3",
        "otherUserCxIds": [
            "55555:aaa-bbb-ccc-ddd:asdfjkl"
        ],
        "isReady": false,
        "extraJson": {},
        "teamCode": "blue"
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/joinlobbywithpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/joinlobbywithpingdata -->

# JoinLobbyWithPingData

Adds the caller to the given lobby instance.

Use [PingRegions](/api/capi/lobby/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

**C#:**

```csharp
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);
```

**C++:**

```cpp
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);
```

**Obj-C:**

```objectivec
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];
```

**Java:**

```java
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()));
}
```

**JavaScript:**

```javascript
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));
});
```

**Dart:**

```dart
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}");
}
```

**Roblox:**

```lua
local lobbyId = "123456:4v4:3"
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }
local isReady = false
local extraJson = {}
local teamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:joinLobbyWithPingData(lobbyId, isReady, extraJson, teamCode, otherUserCxIds, callback)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Needs ping data: call getRegionsForLobbies() and pingRegions() first.
local lobbyId = "123456:4v4:3"
local isReady = false
local extraJson = {}
local teamCode = "blue"
local otherUserCxIds = { "123456:aaa-bbb-ccc-ddd:asdfjkl" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:joinLobbyWithPingData(lobbyId, isReady, extraJson, teamCode, otherUserCxIds, callback)
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
    "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
        }
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/leavelobby.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/leavelobby -->

# LeaveLobby

Causes the caller to leave the specified lobby. If the user was the owner, a new owner will be chosen. If user was the last member, the lobby will be deleted.

| Service | Operation |
| ------- | --------- |
| lobby | LEAVE_LOBBY |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | Id of chosen lobby.

## Usage

**C#:**

```csharp
string lobbyId = "55555:4v4:19";
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.LeaveLobby(lobbyId, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "55555:4v4:19";
_bc->getLobbyService()->leaveLobby(lobbyId, this);
```

**Obj-C:**

```objectivec
NSString *lobbyId = @"55555:4v4:19";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] leaveLobby:lobbyId
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "55555:4v4:19";
this; // implements IServerCallback

_bc.getLobbyService().leaveLobby(lobbyId, 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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "55555:4v4:19";

_bc.lobby.leaveLobby(lobbyId, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "55555:4v4:19";

ServerResponse result = await _bc.lobbyService.leaveLobby(lobbyId:lobbyId);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyId = "55555:4v4:19"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:leaveLobby(lobbyId, callback)
```

**GDScript:**

```gdscript
var lobby_id = "55555:4v4:19"

var result = await _bc.lobby_service.leave_lobby(lobby_id)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "55555:4v4:19"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:leaveLobby(lobbyId, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.leaveLobby(lobbyId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "LEAVE_LOBBY",
    "data": {
        "lobbyId": "55555:4v4:19"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```
</details>

<details>
<summary>Common Error Code</summary>

### Status Codes
Code | Name | Description
---- | ---- | -----------
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature

</details>


---

<!-- source: docs/api/2_capi/lobby/pingregions.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/pingregions -->

# PingRegions

Retrieves associated PingData averages to be used with all associated WithPingData APIs.
Call anytime after GetRegionsForLobbies before proceeding.

## Usage

**C#:**

```csharp
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.PingRegions(successCallback, failureCallback);
```

**C++:**

```cpp
_bc->getLobbyService()->pingRegions(this);
```

**Obj-C:**

```objectivec
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] pingRegions:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
this; // implements IServerCallback

_bc.getLobbyService().pingRegions(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()));
}
```

**JavaScript:**

```javascript
_bc.lobby.pingRegions(result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
ServerResponse result = await _bc.lobbyService.pingRegions();

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:pingRegions(callback)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:pingRegions(callback)
```

**Cloud Code:**

```cfscript
N/A
```

**Raw:**

```r
// N/A
```


---

<!-- source: docs/api/2_capi/lobby/removemember.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/removemember -->

# RemoveMember

Evicts the specified user from the specified lobby. The caller must be the owner of the lobby.

| Service | Operation |
| ------- | --------- |
| lobby | REMOVE_MEMBER |

## Method Parameters

| Parameter    | Description                                                         |
| ------------ | ------------------------------------------------------------------- |
| lobbyId      | Id of chosen lobby.                                                 |
| connectionID | RTT connection id of specified member to be removed from the lobby. |

## Usage

**C#:**

```csharp
string lobbyId = "55555:4v4:19";
string cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";
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.RemoveMember(lobbyId, cxId, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "55555:4v4:19";
const char *cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";
_bc->getLobbyService()->removeMember(lobbyId, cxId, this);
```

**Obj-C:**

```objectivec
NSString *lobbyId = @"55555:4v4:19";
NSString *cxId = @"55555:aaa-bbb-ccc-ddd:asdfjkl";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] removeMember:lobbyId
                       cxId:cxId
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "55555:4v4:19";
String cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";
this; // implements IServerCallback

_bc.getLobbyService().removeMember(lobbyId, cxId, 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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "55555:4v4:19";
var cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";

_bc.lobby.removeMember(lobbyId, cxId, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "55555:4v4:19";
var  connectionId = "55555:aaa-bbb-ccc-ddd:asdfjkl";

ServerResponse result = await _bc.lobbyService.removeMember(lobbyId:lobbyId, connectionId:connectionId);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyId = "55555:4v4:19"
local connectionId = "55555:aaa-bbb-ccc-ddd:asdfjkl"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:removeMember(lobbyId, connectionId, callback)
```

**GDScript:**

```gdscript
var lobby_id = "55555:4v4:19"
var connection_id = "55555:aaa-bbb-ccc-ddd:asdfjkl"

var result = await _bc.lobby_service.remove_member(lobby_id, connection_id)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "55555:4v4:19"
local cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:removeMember(lobbyId, cxId, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.removeMember(lobbyId, cxId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "REMOVE_MEMBER",
    "data": {
        "lobbyId": "55555:4v4:19",
        "cxId": "55555:aaa-bbb-ccc-ddd:asdfjkl"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {},
    "status": 200
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/2_capi/lobby/sendsignal.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sendsignal -->

# SendSignal

Sends LOBBY_SIGNAL_DATA message to all lobby members.

| Service | Operation |
| ------- | --------- |
| lobby | SEND_SIGNAL |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | Id of chosen lobby.
signalData | Signal data to be sent.

## Usage

**C#:**

```csharp
string lobbyId = "55555:4v4:19";
string signalData = "{}";
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.SendSignal(lobbyId, signalData, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "55555:4v4:19";
const char *signalData = "{}";
_bc->getLobbyService()->sendSignal(lobbyId, signalData, this);
```

**Obj-C:**

```objectivec
NSString *lobbyId = @"55555:4v4:19";
NSString *signalData = @"{}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] sendSignal:lobbyId
                 signalData:signalData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "55555:4v4:19";
String signalData = "{}";
this; // implements IServerCallback

_bc.getLobbyService().sendSignal(lobbyId, signalData, 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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "55555:4v4:19";
var signalData = {};

_bc.lobby.sendSignal(lobbyId, signalData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "55555:4v4:19";
var  signalData = {};

ServerResponse result = await _bc.lobbyService.sendSignal(lobbyId:lobbyId, signalData:signalData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyId = "55555:4v4:19"
local signalData = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:sendSignal(lobbyId, signalData, callback)
```

**GDScript:**

```gdscript
var lobby_id = "55555:4v4:19"
var signal_data = {}

var result = await _bc.lobby_service.send_signal(lobby_id, signal_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "55555:4v4:19"
local signalData = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:sendSignal(lobbyId, signalData, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var signalData = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sendSignal(lobbyId, signalData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SEND_SIGNAL",
    "data": {
        "lobbyId": "55555:4v4:19",
        "signalData": {}
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```
</details>

<details>
<summary>Common Error Code</summary>

### Status Codes
Code | Name | Description
---- | ---- | -----------
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature

</details>


---

<!-- source: docs/api/2_capi/lobby/switchteam.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/switchteam -->

# SwitchTeam

Switches to the specified team (if allowed.)

Sends LOBBY_MEMBER_UPDATED to all lobby members, with copy of member data

| Service | Operation |
| ------- | --------- |
| lobby | SWITCH_TEAM |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | Id of chosen lobby.
toTeamCode | Specified team code.

## Usage

**C#:**

```csharp
string lobbyId = "55555:4v4:19";
string toTeamCode = "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.SwitchTeam(lobbyId, toTeamCode, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "55555:4v4:19";
const char *toTeamCode = "blue";
_bc->getLobbyService()->switchTeam(lobbyId, toTeamCode, this);
```

**Obj-C:**

```objectivec
NSString *lobbyId = @"55555:4v4:19";
NSString *toTeamCode = @"blue";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] switchTeam:lobbyId
                 toTeamCode:toTeamCode
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "55555:4v4:19";
String toTeamCode = "blue";
this; // implements IServerCallback

_bc.getLobbyService().switchTeam(lobbyId, toTeamCode, 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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "55555:4v4:19";
var toTeamCode = "blue";

_bc.lobby.switchTeam(lobbyId, toTeamCode, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "55555:4v4:19";
var  toTeamCode = "blue";

ServerResponse result = await _bc.lobbyService.switchTeam(lobbyId:lobbyId, toTeamCode:toTeamCode);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyId = "55555:4v4:19"
local toTeamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:switchTeam(lobbyId, toTeamCode, callback)
```

**GDScript:**

```gdscript
var lobby_id = "55555:4v4:19"
var to_team_code = "blue"

var result = await _bc.lobby_service.switch_team(lobby_id, to_team_code)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "55555:4v4:19"
local toTeamCode = "blue"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:switchTeam(lobbyId, toTeamCode, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var toTeamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.switchTeam(lobbyId, toTeamCode);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SWITCH_TEAM",
    "data": {
        "lobbyId": "55555:4v4:19",
        "toTeamCode": "blue"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```
</details>

<details>
<summary>Common Error Code</summary>

### Status Codes
Code | Name | Description
---- | ---- | -----------
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature

</details>


---

<!-- source: docs/api/2_capi/lobby/sysaddmember.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysaddmember -->

# SysAddMember

Adds the given member to the given lobby instance.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ADD_MEMBER |

## Method Parameters

| Parameter      | Description                                                                                                            |
| -------------- | ---------------------------------------------------------------------------------------------------------------------- |
| memberCxId     | The cx id of the member being added.                                                                                   |
| 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.                             |

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var memberCxId = "55555:aaa-bbb-ccc-ddd:ljljlj";
var lobbyId = "55555:4v4:3";
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-eee:asdfjkl"
];
var isReady = False;
var extraJson = {};
var teamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysAddMember(memberCxId, lobbyId, otherUserCxIds, isReady, extraJson, teamCode);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_ADD_MEMBER",
    "data":{
        "memberCxId":"55555:aaa-bbb-ccc-ddd:ljljlj",
        "lobbyId":"55555:4v4:3",
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-eee:asdfjkl"
        ],
        "isReady":false,
        "extraJson":{},
        "teamCode":"blue"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/sysaddmemberwithpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysaddmemberwithpingdata -->

# SysAddMemberWithPingData

Adds the given member to the given lobby instance.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ADD_MEMBER_WITH_PING_DATA |

## Method Parameters

| Parameter      | Description                                                                                                                                       |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| memberCxId     | The cx id of the member to add.                                                                                                                   |
| 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 retrieve the list of regions for a given lobby type. |

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var memberCxId = "55555:aaa-bbb-ccc-ddd:llljlj";
var lobbyId = "55555:4v4:3";
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-eee: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.sysAddMemberWithPingData(memberCxId, lobbyId, otherUserCxIds, isReady, extraJson, teamCode, pingData);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_ADD_MEMBER_WITH_PING_DATA",
    "data":{
        "memberCxId":"55555:aaa-bbb-ccc-ddd:llljlj",
        "lobbyId":"55555:4v4:3",
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-eee:asdfjkl"
        ],
        "isReady":false,
        "extraJson":{},
        "teamCode":"blue",
        "pingData":{
            "ca-central-1":98,
            "us-west-1":123
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/syscreatelobby.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/syscreatelobby -->

# SysCreateLobby

Creates an instance of a lobby. Will return the newly created lobby id in the event of a successful creation.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_CREATE_LOBBY |

## Method Parameters

| Parameter      | Description                                                                                                                                                                          |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ownerCxId      | The cx of the lobby instance owner.                                                                                                                                                  |
| lobbyType      | The type of lobby to look for. Lobby types are defined in the portal.                                                                                                                |
| rating         | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved). |
| otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.                      |
| settings       | Owner settings for this lobby.                                                                                                                                                       |
| 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.                                                                                           |

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var ownerCxId = "55555:aaa-bbb-ccc-ddd:asfasdf";
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-eee:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysCreateLobby(ownerCxId, lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_CREATE_LOBBY",
    "data":{
        "ownerCxId":"55555:aaa-bbb-ccc-ddd:asfasdf",
        "lobbyType":"4v4",
        "rating":76,
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-eee:asdfjkl"
        ],
        "settings":{},
        "isReady":false,
        "extraJson":{},
        "teamCode":"blue"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "lobbyId": "24797:CursorPartyV2:5"
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/syscreatelobbywithconfig.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/syscreatelobbywithconfig -->

# SysCreateLobbyWithConfig
Creates an instance of a lobby with a per-instance configuration override. Currently supports overriding the standard lobby type's team definitions. Will return the newly created lobby id in the event of a successful creation.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_CREATE_LOBBY_WITH_CONFIG |

## Method Parameters
Parameter | Description
--------- | -----------
ownerCxId | The cx of the lobby instance owner.
lobbyType | The type of lobby to look for. Lobby types are defined in the portal.
rating | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).
otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.
settings | Owner settings for this lobby.
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.
configOverrides | Per-instance configuration overrides applied on top of the standard lobby type. Currently supports `teams` (a complete replacement list of team definitions: `code`, `minUsers`, `maxUsers`, `autoAssign`).

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var ownerCxId = "55555:aaa-bbb-ccc-ddd:asfasdf";
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-eee:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysCreateLobbyWithConfig(ownerCxId, lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_CREATE_LOBBY_WITH_CONFIG",
    "data":{
        "ownerCxId":"55555:aaa-bbb-ccc-ddd:asfasdf",
        "lobbyType":"4v4",
        "rating":76,
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-eee:asdfjkl"
        ],
        "settings":{},
        "isReady":false,
        "extraJson":{},
        "teamCode":"reserved",
        "configOverrides":{
            "teams":[
                {
                    "code":"reserved",
                    "minUsers":0,
                    "maxUsers":1,
                    "autoAssign":false
                },
                {
                    "code":"all",
                    "minUsers":6,
                    "maxUsers":6,
                    "autoAssign":true
                }
            ]
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
  "data": {
    "lobbyId": "23782:Relay_lobbyT_v2:1"
  },
  "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/syscreatelobbywithconfigandpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/syscreatelobbywithconfigandpingdata -->

# SysCreateLobbyWithConfigAndPingData
Creates an instance of a lobby with a per-instance configuration override and the given ping data. Currently supports overriding the standard lobby type's team definitions. Will return the newly created lobby id in the event of a successful creation.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_CREATE_LOBBY_WITH_CONFIG_AND_PING_DATA |

## Method Parameters
Parameter | Description
--------- | -----------
ownerCxId | The cx of the lobby instance owner.
lobbyType | The type of lobby to look for. Lobby types are defined in the portal.
rating | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved).
otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.
settings | Owner settings for this lobby.
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.
configOverrides | Per-instance configuration overrides applied on top of the standard lobby type. Currently supports `teams` (a complete replacement list of team definitions: `code`, `minUsers`, `maxUsers`, `autoAssign`).
pingData | Ping times for each region available for this lobby type. Can use GET_REGIONS_FOR_LOBBIES to retrieve the list of regions for a given lobby type.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var ownerCxId = "55555:aaa-bbb-ccc-ddd:asdfasdfa";
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-eee:asdfjkl"
];
var settings = {};
var isReady = False;
var extraJson = {};
var teamCode = "reserved";
var configOverrides = {
    "teams": [
        {
            "code": "reserved",
            "minUsers": 0,
            "maxUsers": 1,
            "autoAssign": false
        },
        {
            "code": "all",
            "minUsers": 6,
            "maxUsers": 6,
            "autoAssign": true
        }
    ]
};
var pingData = {
    "ca-central-1": 98,
    "us-west-1": 123
};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysCreateLobbyWithConfigAndPingData(ownerCxId, lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, configOverrides, pingData);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_CREATE_LOBBY_WITH_CONFIG_AND_PING_DATA",
    "data":{
        "ownerCxId":"55555:aaa-bbb-ccc-ddd:asdfasdfa",
        "lobbyType":"4v4",
        "rating":76,
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-eee:asdfjkl"
        ],
        "settings":{},
        "isReady":false,
        "extraJson":{},
        "teamCode":"reserved",
        "configOverrides":{
            "teams":[
                {
                    "code":"reserved",
                    "minUsers":0,
                    "maxUsers":1,
                    "autoAssign":false
                },
                {
                    "code":"all",
                    "minUsers":6,
                    "maxUsers":6,
                    "autoAssign":true
                }
            ]
        },
        "pingData":{
            "ca-central-1":98,
            "us-west-1":123
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
  "data": {
    "lobbyId": "23782:Relay_lobbyT_v2:1"
  },
  "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/syscreatelobbywithpingdata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/syscreatelobbywithpingdata -->

# SysCreateLobbyWithPingData

Creates an instance of a lobby. Will return the newly created lobby id in the event of a successful creation.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_CREATE_LOBBY_WITH_PING_DATA |

## Method Parameters

| Parameter      | Description                                                                                                                                                                          |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ownerCxId      | The cx of the lobby instance owner.                                                                                                                                                  |
| lobbyType      | The type of lobby to look for. Lobby types are defined in the portal.                                                                                                                |
| rating         | The skill rating to use for finding the lobby. Provided as a separate parameter because it may not exactly match the user's rating (especially in cases where parties are involved). |
| otherUserCxIds | Array of other users (i.e. party members) to add to the lobby as well. Will constrain things so that only lobbies with room for all players will be considered.                      |
| settings       | Owner settings for this lobby.                                                                                                                                                       |
| 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 retrieve the list of regions for a given lobby type.                                    |

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var ownerCxId = "55555:aaa-bbb-ccc-ddd:asdfasdfa";
var lobbyType = "4v4";
var rating = 76;
var otherUserCxIds = [
    "55555:aaa-bbb-ccc-eee:asdfjkl"
];
var settings = {};
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.sysCreateLobbyWithPingData(ownerCxId, lobbyType, rating, otherUserCxIds, settings, isReady, extraJson, teamCode, pingData);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_CREATE_LOBBY_WITH_PING_DATA",
    "data":{
        "ownerCxId":"55555:aaa-bbb-ccc-ddd:asdfasdfa",
        "lobbyType":"4v4",
        "rating":76,
        "otherUserCxIds":[
            "55555:aaa-bbb-ccc-eee:asdfjkl"
        ],
        "settings":{},
        "isReady":false,
        "extraJson":{},
        "teamCode":"blue",
        "pingData":{
            "ca-central-1":98,
            "us-west-1":123
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "lobbyId": "24797:CursorPartyV2:5"
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/sysdisbandlobby.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysdisbandlobby -->

# SysDisbandLobby

Disbands the given lobby. `msg` and `details` are optional values.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_DISBAND_LOBBY |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | The id of lobby that this room server is associated with. 
msg | Optional message to send to lobby members. 
details | Optional data to send to lobby members. 

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var msg = "Game over";
var details = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysDisbandLobby(lobbyId, msg, details);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_DISBAND_LOBBY",
    "data": {
        "lobbyId": "55555:4v4:19",
        "msg": "Game over",
        "details": {}
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/sysgetlobbydata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysgetlobbydata -->

# SysGetLobbyData

Gets data for the given lobby instance ``<lobbyId>``.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_GET_LOBBY_DATA |

## Method Parameters

| Parameter | Description         |
| --------- | ------------------- |
| lobbyId   | Id of chosen lobby. |

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysGetLobbyData(lobbyId);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_GET_LOBBY_DATA",
    "data":{
        "lobbyId":"55555:4v4:19"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "id": "24797:CursorPartyV2:6",
        "lobbyType": "CursorPartyV2",
        "state": "early",
        "rating": 76,
        "ownerCxId": "24797:93293c42-7a8e-47b4-954e-553916193687:qipp3o63n7bsppsa76p0uq11bd",
        "lobbyTypeDef": {
            "roomConfig": {
                "enableDisconnectButton": false
            },
            "lobbyTypeId": "CursorPartyV2",
            "teams": {
                "all": {
                    "minUsers": 1,
                    "maxUsers": 8,
                    "autoAssign": true,
                    "code": "all"
                }
            },
            "rules": {
                "allowEarlyStartWithoutMax": true,
                "forceOnTimeStartWithoutReady": true,
                "allowJoinInProgress": true,
                "onTimeStartSecs": 600,
                "disbandOnStart": false,
                "everyReadyMinPercent": 0,
                "everyReadyMinNum": 1,
                "earliestStartSecs": 1,
                "tooLateSecs": 600
            },
            "desc": "Uses protocol V2"
        },
        "settings": {},
        "version": 1,
        "connectData": {},
        "timetable": {
            "createdAt": 1733872893606,
            "early": 1733872894606,
            "onTime": 1733873493606,
            "tooLate": 1733873493606,
            "dropDead": 1733877093606,
            "ignoreDropDeadUntil": 1733877093606
        },
        "cRegions": [],
        "round": 1,
        "isRoomReady": false,
        "keepAliveRateSeconds": 1440,
        "isAvailable": true,
        "shardId": 0,
        "legacyLobbyOwnerEnabled": false,
        "numMembers": 2,
        "members": [
            {
                "profileId": "5ad5976d-29d9-4f02-b097-0072fe69c2e8",
                "name": "cran",
                "pic": "",
                "rating": 76,
                "team": "all",
                "isReady": false,
                "extra": {},
                "passcode": "6aedce",
                "ipAddress": "APIExplorer",
                "cxId": "24797:5ad5976d-29d9-4f02-b097-0072fe69c2e8:8p70du41jiaic4tnnsrptem5b"
            },
            {
                "profileId": "93293c42-7a8e-47b4-954e-553916193687",
                "name": "candy",
                "pic": "",
                "rating": 76,
                "team": "all",
                "isReady": false,
                "extra": {},
                "passcode": "34535f",
                "ipAddress": "APIExplorer",
                "cxId": "24797:93293c42-7a8e-47b4-954e-553916193687:qipp3o63n7bsppsa76p0uq11bd"
            }
        ]
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/sysgetlobbymember.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysgetlobbymember -->

# SysGetLobbyMember

Retrieves lobby membership details for the specified user.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_GET_LOBBY_MEMBER |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | Id of chosen lobby
cxId | RTT connection id of a lobby member

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysGetLobbyMember(lobbyId, cxId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_GET_LOBBY_MEMBER",
    "data": {
        "lobbyId": "55555:4v4:19",
        "cxId": "55555:aaa-bbb-ccc-ddd:asdfjkl"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "profileId": "c394230e-53c0-4ba3-8eed-90963e58de9c",
        "name": "",
        "pic": "",
        "rating": 1200,
        "team": "all",
        "isReady": true,
        "extra": {},
        "passcode": "8ebbd5",
        "cxId": "13229:c394230e-53c0-4ba3-8eed-90963e58de9c:il6dpch4c8g4jm6p3o5vc85ssq"
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/lobby/sysmemberleft.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysmemberleft -->

# SysMemberLeft

Informs brainCloud that the specified user has left the specified lobby.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_MEMBER_LEFT |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | The id of lobby that should be returned to the 'setup' state
cxId | RTT connection id of specified member to be removed from the lobby
reason | Optional reason for the member leaving. Can be one of 'LEFT_BY_CHOICE', 'EVICTED', or 'LOST_CONNECTION'
newOwnerCxId | Optional RTT connection id of another lobby member to be made owner of the lobby if the member leaving is the current owner

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";
var reason = "EVICTED";
var newOwnerCxId = "55555:eee-fff-ggg-hhh:asdfjkl"
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysMemberLeft(lobbyId, cxId, reason, newOwnerCxId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_MEMBER_LEFT",
    "data": {
        "lobbyId": "55555:4v4:19",
        "cxId": "55555:aaa-bbb-ccc-ddd:asdfjkl",
        "reason": "EVICTED",
        "newOwnerCxId": "55555:eee-fff-ggg-hhh:asdfjkl"
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/sysremovemember.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysremovemember -->

# SysRemoveMember

Evicts the specified user from the specified lobby.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_REMOVE_MEMBER |

## Method Parameters

| Parameter | Description                                                         |
| --------- | ------------------------------------------------------------------- |
| lobbyId   | Id of chosen lobby.                                                 |
| cxId      | RTT connection id of specified member to be removed from the lobby. |

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var cxId = "55555:aaa-bbb-ccc-ddd:asdfjkl";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysRemoveMember(lobbyId, cxId);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_REMOVE_MEMBER",
    "data":{
        "lobbyId":"55555:4v4:19",
        "cxId":"55555:aaa-bbb-ccc-ddd:asdfjkl"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/sysroomcancelled.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysroomcancelled -->

# SysRoomCancelled

Tells the lobby system that creation of the room experience failed.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ROOM_CANCELLED |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | The id of lobby that this room server is associated with
connectInfo | Info the clients will use to connect to the room server
details | Optional data to send to room members.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var msg = "Server going down for maintenance";
var details = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysRoomCancelled(lobbyId, msg, details);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_ROOM_CANCELLED",
    "data": {
        "lobbyId": "55555:4v4:19",
        "msg": "Server going down for maintenance",
        "details": {}
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```
</details>

<details>
<summary>Common Error Code</summary>

### Status Codes
Code | Name | Description
---- | ---- | -----------
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature

</details>


---

<!-- source: docs/api/2_capi/lobby/sysroomkeepalive.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysroomkeepalive -->

# SysRoomKeepAlive
Indicates that a room is still running and the associated lobby instance should be kept alive.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ROOM_KEEP_ALIVE |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | The id of lobby that should be kept alive.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.SysRoomKeepAlive(lobbyId);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_ROOM_KEEP_ALIVE",
    "data":{
        "lobbyId":"55555:4v4:19"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": null
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/sysroomready.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysroomready -->

# SysRoomReady

Indicates that a room is ready for use by the members of the given lobby.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ROOM_READY |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | The id of lobby that this room server is associated with.
connectData | Optionally override the connectData of the lobby instance. Pass null or {} to preserve the existing connectData.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var connectData = {
    "address": "1.2.3.4",
    "ports": {
        "udp": 9000,
        "tcp": 9000,
        "ws": 9001
    }
};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysRoomReady(lobbyId, connectData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_ROOM_READY",
    "data": {
        "lobbyId": "55555:4v4:19",
        "connectData": {
            "address": "1.2.3.4",
            "ports": {
                "udp": 9000,
                "tcp": 9000,
                "ws": 9001
            }
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```
</details>

<details>
<summary>Common Error Code</summary>

### Status Codes
Code | Name | Description
---- | ---- | -----------
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature

</details>


---

<!-- source: docs/api/2_capi/lobby/sysroomstopped.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysroomstopped -->

# SysRoomStopped

Indicates that the gameplay for the room associated with the given lobby has completed. The lobby can be returned to the 'setup' state.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ROOM_STOPPED |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | The id of lobby that should be returned to the 'setup' state

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysRoomStopped(lobbyId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_ROOM_STOPPED",
    "data": {
        "lobbyId": "55555:4v4:19"
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/syssendsignal.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/syssendsignal -->

# SysSendSignal

Send the given data to all members of the given lobby.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_SEND_SIGNAL |

## Method Parameters
Parameter | Description
--------- | -----------
lobbyId | Id of chosen lobby. 
signalData | Signal data to be sent. 
from | Optional 'from' data to be sent. 

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "123456:4v4:19";
var signalData = {};
var from = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysSendSignal(lobbyId, signalData, from);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_SEND_SIGNAL",
    "data": {
        "lobbyId": "55555:4v4:19",
        "signalData": {},
        "from": {}
    }
}
```


---

<!-- source: docs/api/2_capi/lobby/sysupdatesettings.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/sysupdatesettings -->

# SysUpdateSettings

Updates the settings for the given lobby instance.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_UPDATE_SETTINGS |

## Method Parameters

| Parameter | Description                      |
| --------- | -------------------------------- |
| lobbyId   | Id of the specified lobby.       |
| settings  | Configuration data for the room. |

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var settings = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysUpdateSettings(lobbyId, settings);
```

**Raw:**

```r
{
    "service":"lobby",
    "operation":"SYS_UPDATE_SETTINGS",
    "data":{
        "lobbyId":"55555:4v4:19",
        "settings":{}
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```

</details>


---

<!-- source: docs/api/2_capi/lobby/updateready.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/updateready -->

# UpdateReady

Updates the ready status and extra json for the given lobby member.

| Service | Operation |
| ------- | --------- |
| lobby | UPDATE_READY |

## Method Parameters

| Parameter | Description                         |
| --------- | ----------------------------------- |
| lobbyId   | Id of chosen lobby.                 |
| isReady   | Initial ready-status of this user.  |
| extraJson | Initial extra-data about this user. |

## Usage

**C#:**

```csharp
string lobbyId = "55555:4v4:19";
bool isReady = true;
string extraJson = "{}";
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.UpdateReady(lobbyId, isReady, extraJson, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "55555:4v4:19";
bool isReady = true;
const char *extraJson = "{}";
_bc->getLobbyService()->updateReady(lobbyId, isReady, extraJson, this);
```

**Obj-C:**

```objectivec
NSString *lobbyId = @"55555:4v4:19";
bool isReady = true;
NSString *extraJson = @"{}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] updateReady:lobbyId
                    isReady:isReady
                  extraJson:extraJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "55555:4v4:19";
boolean isReady = true;
String extraJson = "{}";
this; // implements IServerCallback

_bc.getLobbyService().updateReady(lobbyId, isReady, extraJson, 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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "55555:4v4:19";
var isReady = true;
var extraJson = {};

_bc.lobby.updateReady(lobbyId, isReady, extraJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "55555:4v4:19";
var  isReady = true;
var  extraJson = {};

ServerResponse result = await _bc.lobbyService.updateReady(lobbyId:lobbyId, isReady:isReady, extraJson:extraJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyId = "55555:4v4:19"
local isReady = true
local extraJson = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:updateReady(lobbyId, isReady, extraJson, callback)
```

**GDScript:**

```gdscript
var lobby_id = "55555:4v4:19"
var is_ready = true
var extra_json = {}

var result = await _bc.lobby_service.update_ready(lobby_id, is_ready, extra_json)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "55555:4v4:19"
local isReady = true
local extraJson = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:updateReady(lobbyId, isReady, extraJson, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var isReady = true;
var extraJson = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.updateReady(lobbyId, isReady, extraJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "UPDATE_READY",
    "data": {
        "lobbyId": "55555:4v4:19",
        "isReady": true,
        "extraJson": {}
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {},
    "status": 200
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/2_capi/lobby/updatesettings.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/lobby/updatesettings -->

# UpdateSettings

Updates the settings for the given lobby instance. The caller must be the owner of the lobby.

| Service | Operation |
| ------- | --------- |
| lobby | UPDATE_SETTINGS |

## Method Parameters

| Parameter | Description                      |
| --------- | -------------------------------- |
| lobbyId   | Id of the specified lobby.       |
| settings  | Configuration data for the room. |

## Usage

**C#:**

```csharp
string lobbyId = "55555:4v4:19";
string settings = "{}";
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.UpdateSettings(lobbyId, settings, successCallback, failureCallback);
```

**C++:**

```cpp
const char *lobbyId = "55555:4v4:19";
const char *settings = "{}";
_bc->getLobbyService()->updateSettings(lobbyId, settings, this);
```

**Obj-C:**

```objectivec
NSString *lobbyId = @"55555:4v4:19";
NSString *settings = @"{}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc lobbyService] updateSettings:lobbyId
                   settings:settings
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String lobbyId = "55555:4v4:19";
String settings = "{}";
this; // implements IServerCallback

_bc.getLobbyService().updateSettings(lobbyId, settings, 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()));
}
```

**JavaScript:**

```javascript
var lobbyId = "55555:4v4:19";
var settings = {};

_bc.lobby.updateSettings(lobbyId, settings, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  lobbyId = "55555:4v4:19";
var  settings = {};

ServerResponse result = await _bc.lobbyService.updateSettings(lobbyId:lobbyId, settings:settings);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local lobbyId = "55555:4v4:19"
local settings = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:updateSettings(lobbyId, settings, callback)
```

**GDScript:**

```gdscript
var lobby_id = "55555:4v4:19"
var settings = {}

var result = await _bc.lobby_service.update_settings(lobby_id, settings)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local lobbyId = "55555:4v4:19"
local settings = {}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.lobby:updateSettings(lobbyId, settings, callback)
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var settings = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.updateSettings(lobbyId, settings);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "UPDATE_SETTINGS",
    "data": {
        "lobbyId": "55555:4v4:19",
        "settings": {}
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {}
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/4_s2s/lobby/getlobbydata.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/lobby/getlobbydata -->

# GetLobbyData

Returns the data for the specified lobby, including member data.

| Service | Operation |
| ------- | --------- |
| lobby | GET_LOBBY_DATA |

## Method Parameters

| Parameter | Description         |
| --------- | ------------------- |
| lobbyId   | Id of chosen lobby. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4x4:19";
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.getLobbyData(lobbyId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "GET_LOBBY_DATA",
    "data": {
        "lobbyId": "55555:4x4:19"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "id": "13229:Relay_lobbyT_v2:20",
        "lobbyType": "Relay_lobbyT_v2",
        "state": "setup",
        "rating": 0,
        "lobbyTypeDef": {
            "lobbyTypeId": "Relay_lobbyT_v2",
            "teams": {
                "all": {
                    "minUsers": 1,
                    "maxUsers": 8,
                    "autoAssign": true,
                    "code": "all"
                }
            },
            "rules": {
                "allowEarlyStartWithoutMax": true,
                "forceOnTimeStartWithoutReady": true,
                "allowJoinInProgress": false,
                "onTimeStartSecs": 600,
                "disbandOnStart": true,
                "everyReadyMinPercent": 15,
                "everyReadyMinNum": 1,
                "earliestStartSecs": 1,
                "tooLateSecs": 600
            },
            "desc": "starts when 1 player is ready"
        },
        "settings": {},
        "version": 1,
        "connectData": {},
        "timetable": {
            "createdAt": 1631050042177,
            "early": 1631050043177,
            "onTime": 1631050642177,
            "tooLate": 1631050642177
        },
        "cRegions": [],
        "round": 1,
        "ownerCxId": "13229:db4be46d-1e99-41fe-9402-a0e8f7cd7cb5:p57kebat767ogdtesnp5cmd46p",
        "legacyLobbyOwnerEnabled": true,
        "owner": "db4be46d-1e99-41fe-9402-a0e8f7cd7cb5",
        "numMembers": 1,
        "members": [
            {
                "profileId": "db4be46d-1e99-41fe-9402-a0e8f7cd7cb5",
                "name": "",
                "pic": "",
                "rating": 1200,
                "team": "all",
                "isReady": true,
                "extra": {},
                "cxId": "13229:db4be46d-1e99-41fe-9402-a0e8f7cd7cb5:p57kebat767ogdtesnp5cmd46p"
            }
        ]
    },
    "status": 200
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/4_s2s/lobby/getvisiblelobbyinstances.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/lobby/getvisiblelobbyinstances -->

# GetVisibleLobbyInstances

Gets a map keyed by rating of the visible lobby instances matching the given type and rating range.

| Service | Operation |
| ------- | --------- |
| lobby | GET_VISIBLE_LOBBY_INSTANCES |

## Method Parameters

| Parameter | Description                                                           |
| --------- | --------------------------------------------------------------------- |
| lobbyType | The type of lobby to look for. Lobby types are defined in the portal. |
| minRating | The minimum skill rating to use for finding the lobbies.              |
| maxRating | The maximum skill rating to use for finding the lobbies.              |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var lobbyType = "Relay_lobbyT_v2";
var minRating = 10;
var maxRating = 100;
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.getVisibleLobbyInstances(lobbyType, minRating, maxRating);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "GET_VISIBLE_LOBBY_INSTANCES",
    "data": {
        "lobbyType": "Relay_lobbyT_v2",
        "minRating": 10,
        "maxRating": 100
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "lobbiesByRating": {
            "20.0": [
                {
                    "id": "23782:Relay_lobbyT_v2:2",
                    "lobbyType": "Relay_lobbyT_v2",
                    "state": "setup",
                    "rating": 20,
                    "desc": "starts as soon as 1 player is ready",
                    "owner": {
                        "profileId": "10b6d6fa-0aa6-43b0-a7b3-48aff2d13312",
                        "name": "",
                        "rating": 0,
                        "pic": null,
                        "cxId": "23782:10b6d6fa-0aa6-43b0-a7b3-48aff2d13312:52kc0h19k0pnnjhnrp8pug7udd"
                    },
                    "numMembers": 1,
                    "maxMembers": 8
                }
            ]
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/lobby/index.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/lobby -->

# Lobby

For a full overview of the Lobby Service, see the [Lobby Service Client API](/api/capi/lobby).

### API Summary

### LobbyService

-   [GetLobbyData](/api/s2s/lobby/getlobbydata) - Gets data for the given lobby instance.
-   [GetLobbyInstances](/api/capi/lobby/getlobbyinstances) - Gets a map keyed by rating of the visible lobby instances matching the given type and rating range.
-   [GetLobbyInstancesWithPingData](/api/capi/lobby/getlobbyinstanceswithpingdata) - Gets a map keyed by rating of the lobby instances matching the given type, rating range, and ping threshold.
-   [SysRoomReady](/api/s2s/lobby/sysroomready) - Indicates that a room is ready for use by the members of the given lobby.
-   [SysRoomCancelled](/api/s2s/lobby/sysroomcancelled) - Indicates that the room allocation process has been cancelled for the given lobby.
-   [SysSendSignal](/api/s2s/lobby/syssendsignal) - Send the given data to all members of the given lobby.
-   [SysDisbandLobby](/api/s2s/lobby/sysdisbandlobby) - Disbands the given lobby.
-   [SysRoomStopped](/api/capi/lobby/sysroomstopped) - Indicates that the gameplay for the room associated with the given lobby has completed. The lobby can be returned to the 'setup' state.
-   [SysMemberLeft](/api/capi/lobby/sysmemberleft) - Informs brainCloud that the specified user has left the specified lobby.
-   [SysGetLobbyMember](/api/capi/lobby/sysgetlobbymember) - Retrieves lobby membership details for the specified user.
-   [SysAddMember](/api/capi/lobby/sysaddmember) - Adds the given member to the given lobby instance.
-   [SysAddMemberWithPingData](/api/capi/lobby/sysaddmemberwithpingdata) - Adds the given member to the given lobby instance.
-   [SysCreateLobby](/api/capi/lobby/syscreatelobby) - Creates an instance of a lobby. Will return the newly created lobby id in the event of a successful creation.
-   [SysCreateLobbyWithPingData](/api/capi/lobby/syscreatelobbywithpingdata) - Creates an instance of a lobby. Will return the newly created lobby id in the event of a successful creation.
-   [SysGetLobbyData](/api/capi/lobby/sysgetlobbydata) - Gets data for the given lobby instance ``<lobbyId>``.
-   [SysRemoveMember](/api/capi/lobby/sysremovemember) - Evicts the specified user from the specified lobby.
-   [SysUpdateSettings](/api/capi/lobby/sysupdatesettings) - Updates the settings for the given lobby instance.
-   [SysRoomKeepAlive](/api/capi/lobby/sysroomkeepalive) - Indicates that a room is still running and the associated lobby instance should be kept alive.
-   [SysCreateLobbyWithConfig](/api/capi/lobby/syscreatelobbywithconfig) - Creates an instance of a lobby with a per-instance configuration override. Currently supports overriding the standard lobby type's team definitions. Will return the newly created lobby id in the event of a successful creation.
-   [SysCreateLobbyWithConfigAndPingData](/api/capi/lobby/syscreatelobbywithconfigandpingdata) - Creates an instance of a lobby with a per-instance configuration override and the given ping data. Currently supports overriding the standard lobby type's team definitions. Will return the newly created lobby id in the event of a successful creation.

> **Tip:** All the client APIs that the names beigin with <strong>"Sys"</strong> <em>are</em> also available to S2S.
> For the usages of the S2S lobby APIs (if they are not listed at this section below),
> refer to brainCloud client [lobby](/api/capi/lobby) APIs.


---

<!-- source: docs/api/4_s2s/lobby/sysdisbandlobby.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/lobby/sysdisbandlobby -->

# SysDisbandLobby

Disbands the given lobby. `msg` and `details` are optional values.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_DISBAND_LOBBY |

## Method Parameters

| Parameter | Description                                               |
| --------- | --------------------------------------------------------- |
| lobbyId   | The id of lobby that this room server is associated with. |
| msg       | Optional message to send to lobby members.                |
| details   | Optional data to send to lobby members.                   |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var msg = "Server going down for maintenance";
var details = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysDisbandLobby(lobbyId, msg, details);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_DISBAND_LOBBY",
    "data": {
        "lobbyId": "55555:4v4:19",
        "msg": "Server going down for maintenance",
        "details": {}
    }
}
```


---

<!-- source: docs/api/4_s2s/lobby/sysroomcancelled.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/lobby/sysroomcancelled -->

# SysRoomCancelled

Tells the lobby system that creation of the room experience failed.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ROOM_CANCELLED |

## Method Parameters

| Parameter | Description                                               |
| --------- | --------------------------------------------------------- |
| lobbyId   | The id of lobby that this room server is associated with. |
| msg       | Info the clients will use to connect to the room server.  |
| details   | Optional details to send to room members.                 |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var msg = "Server going down for maintenance";
var details = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysRoomCancelled(lobbyId, msg, details);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_ROOM_CANCELLED",
    "data": {
        "lobbyId": "55555:4v4:19",
        "msg": "Server going down for maintenance",
        "details": {}
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {},
    "status": 200
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/4_s2s/lobby/sysroomready.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/lobby/sysroomready -->

# SysRoomReady

Indicates that a room is ready for use by the members of the given lobby.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_ROOM_READY |

## Method Parameters

| Parameter   | Description                                               |
| ----------- | --------------------------------------------------------- |
| lobbyId     | The id of lobby that this room server is associated with. |
| connectData | Optionally override the connectData of the lobby instance. Pass null or {} to preserve the existing connectData. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var connectData = {
  "address": "1.2.3.4",
  "ports": {
    "udp": 9000,
    "tcp": 9000,
    "ws": 9001
  }
};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysRoomReady(lobbyId, connectData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
  "service": "lobby",
  "operation": "SYS_ROOM_READY",
  "data": {
  "lobbyId": "55555:4v4:19",
  "connectData": {
    "address": "1.2.3.4",
    "ports": {
      "udp": 9000,
      "tcp": 9000,
      "ws": 9001
    }
  }
}
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {},
    "status": 200
}
```

</details>

<details>
<summary>Common Error Code</summary>

### Status Codes

| Code  | Name            | Description                          |
| ----- | --------------- | ------------------------------------ |
| 40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |

</details>


---

<!-- source: docs/api/4_s2s/lobby/syssendsignal.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/lobby/syssendsignal -->

# SysSendSignal

Send the given data to all members of the given lobby.

| Service | Operation |
| ------- | --------- |
| lobby | SYS_SEND_SIGNAL |

## Method Parameters

| Parameter  | Description                      |
| ---------- | -------------------------------- |
| lobbyId    | Id of chosen lobby.              |
| signalData | Signal data to be sent.          |
| from       | Optional 'from' data to be sent. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var lobbyId = "55555:4v4:19";
var signalData = {};
var from = {};
var lobbyProxy = bridge.getLobbyServiceProxy();

var postResult = lobbyProxy.sysSendSignal(lobbyId, signalData, from);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "lobby",
    "operation": "SYS_SEND_SIGNAL",
    "data": {
        "lobbyId": "55555:4v4:19",
        "signalData": {},
        "from": {}
    }
}
```
