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

# RoomServer

**RoomServer** service allows devs to directly launch hosted servers without going through lobby matchmaking.

### API Summary

-   [SysGetRoomMember](/api/capi/roomserver/sysgetroommember) - Used to retrieve the details of the given room member.
-   [SysLaunchServer](/api/capi/roomserver/syslaunchserver) - Launch a hosted server directly. Allows for the bypassing of brainCloud lobby matchmaking.
-   [SysRoomEvent](/api/capi/roomserver/sysroomevent) - Arbitrary method for calling the script associated with a directly launched hosted server instance.
-   [SysRoomReady](/api/capi/roomserver/sysroomready) - Indicates that a room is ready for use by the members.
-   [SysRoomSessionEnded](/api/capi/roomserver/sysroomsessionended) - Indicates that the given server instance has ended.
-   [SysRoomSessionStarted](/api/capi/roomserver/sysroomsessionstarted) - Indicates that the given server instance has started.
-   [SysUpdateRoomServerImage](/api/capi/roomserver/sysupdateroomserverimage) - Updates the Docker image for the specified room server configuration. Automatically increments the server config version.


---

<!-- source: docs/api/2_capi/roomserver/sysgetroommember.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/roomserver/sysgetroommember -->

# SysGetRoomMember
Used to retrieve the details of the given room member.

| Service | Operation |
| ------- | --------- |
| roomServer | SYS_GET_ROOM_MEMBER |

## Method Parameters
Parameter | Description
--------- | -----------
member | Member data used as input to a direct launch provider for validating the connection of a client.
brainCloudContext | Data provided by brainCloud when the server instance was launched.

## 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 member = {
    "cxId": "55555:abc:123"
};
var brainCloudContext = {
    "scriptId": "my-script-id",
    "scriptData": {
        "abc": "xyz"
    }
};
var roomServerProxy = bridge.getRoomServerServiceProxy();

var postResult = roomServerProxy.sysGetRoomMember(member, brainCloudContext);
```

**Raw:**

```r
{
    "service":"roomServer",
    "operation":"SYS_GET_ROOM_MEMBER",
    "data":{
        "member":{
            "cxId":"55555:abc:123"
        },
        "brainCloudContext":{
            "scriptId":"my-script-id",
            "scriptData":{
                "abc":"xyz"
            }
        }
    }
}
```

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

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

</details>


---

<!-- source: docs/api/2_capi/roomserver/syslaunchserver.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/roomserver/syslaunchserver -->

# SysLaunchServer
Launch a hosted server directly. Allows for the bypassing of brainCloud lobby matchmaking.

| Service | Operation |
| ------- | --------- |
| roomServer | SYS_LAUNCH_SERVER |

## Method Parameters
Parameter | Description
--------- | -----------
serverName | The type of server to launch as defined in App > Design > Servers > My Servers .
scriptName | The name of the cloud code script to invoke for all hosted server launch events. Should be the whole path to the script.
scriptData | Optional JSON object that will be sent as input to the associated cloud code script.
regionId | Optional region id to target for the hosted server launch.

## 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 serverName = "my-server-type";
var scriptName = "script-name";
var scriptData = {
    "abc": "xyz"
};
var regionId = "ca-central-1";
var roomServerProxy = bridge.getRoomServerServiceProxy();

var postResult = roomServerProxy.sysLaunchServer(serverName, scriptName, scriptData, regionId);
```

**Raw:**

```r
{
    "service":"roomServer",
    "operation":"SYS_LAUNCH_SERVER",
    "data":{
        "serverName":"my-server-type",
        "scriptName":"script-name",
        "scriptData":{
            "abc":"xyz"
        },
        "regionId":"ca-central-1"
    }
}
```

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

```json
{
    "data": {
        "serverId": "23782:d1787dee-7a3a-42e1-a2ae-74e08ca507f5"
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/roomserver/sysroomevent.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/roomserver/sysroomevent -->

# SysRoomEvent
Arbitrary method for calling the script associated with a directly launched hosted server instance.

| Service | Operation |
| ------- | --------- |
| roomServer | SYS_ROOM_EVENT |

## Method Parameters
Parameter | Description
--------- | -----------
event | Custom data object.
brainCloudContext | Data provided by brainCloud when the server instance was launched.

## 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 event = {
    "123": "456"
};
var brainCloudContext = {
    "scriptId": "my-script-id",
    "scriptData": {
        "abc": "xyz"
    }
};
var roomServerProxy = bridge.getRoomServerServiceProxy();

var postResult = roomServerProxy.sysRoomEvent(event, brainCloudContext);
```

**Raw:**

```r
{
    "service":"roomServer",
    "operation":"SYS_ROOM_EVENT",
    "data":{
        "event":{
            "123":"456"
        },
        "brainCloudContext":{
            "scriptId":"my-script-id",
            "scriptData":{
                "abc":"xyz"
            }
        }
    }
}
```

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

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

</details>


---

<!-- source: docs/api/2_capi/roomserver/sysroomready.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/roomserver/sysroomready -->

# SysRoomReady
Indicates that a room is ready for use by the members.

| Service | Operation |
| ------- | --------- |
| roomServer | SYS_ROOM_READY |

## Method Parameters
Parameter | Description
--------- | -----------
brainCloudContext | Data provided by brainCloud when the server instance was launched.

## 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 brainCloudContext = {
    "scriptId": "my-script-id",
    "scriptData": {
        "abc": "xyz"
    }
};
var roomServerProxy = bridge.getRoomServerServiceProxy();

var postResult = roomServerProxy.sysRoomReady(brainCloudContext);
```

**Raw:**

```r
{
    "service":"roomServer",
    "operation":"SYS_ROOM_READY",
    "data":{
        "brainCloudContext":{
            "scriptId":"my-script-id",
            "scriptData":{
                "abc":"xyz"
            }
        }
    }
}
```

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

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

</details>


---

<!-- source: docs/api/2_capi/roomserver/sysroomsessionended.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/roomserver/sysroomsessionended -->

# SysRoomSessionEnded
Indicates that the given server instance has ended.

| Service | Operation |
| ------- | --------- |
| roomServer | SYS_ROOM_SESSION_ENDED |

## Method Parameters
Parameter | Description
--------- | -----------
serverId | The room server instance id.
serverContext | JSON object containing server context data. Note that serverContext must contain an entry for SERVER_TYPE (currently only 'Hosted' or 'EdgeGap' are supported) and a CONTAINER_KEY entry (provided via the SERVER_CONTEXT env variable when the server instance is launched).

## 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 serverId = "i-abcdef";
var serverContext = {
    "abc": "xyz"
};
var roomServerProxy = bridge.getRoomServerServiceProxy();

var postResult = roomServerProxy.sysRoomSessionEnded(serverId, serverContext);
```

**Raw:**

```r
{
    "service":"roomServer",
    "operation":"SYS_ROOM_SESSION_ENDED",
    "data":{
        "serverId":"i-abcdef",
        "serverContext":{
            "abc":"xyz"
        }
    }
}
```

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

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

</details>


---

<!-- source: docs/api/2_capi/roomserver/sysroomsessionstarted.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/roomserver/sysroomsessionstarted -->

# SysRoomSessionStarted
Indicates that the given server instance has started.

| Service | Operation |
| ------- | --------- |
| roomServer | SYS_ROOM_SESSION_STARTED |

## Method Parameters
Parameter | Description
--------- | -----------
serverId | The room server instance id.
serverContext | JSON object containing server context data.

## 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 serverId = "i-abcdef";
var serverContext = {
    "abc": "xyz"
};
var roomServerProxy = bridge.getRoomServerServiceProxy();

var postResult = roomServerProxy.sysRoomSessionStarted(serverId, serverContext);
```

**Raw:**

```r
{
    "service":"roomServer",
    "operation":"SYS_ROOM_SESSION_STARTED",
    "data":{
        "serverId":"i-abcdef",
        "serverContext":{
            "abc":"xyz"
        }
    }
}
```

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

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

</details>


---

<!-- source: docs/api/2_capi/roomserver/sysupdateroomserverimage.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/roomserver/sysupdateroomserverimage -->

# SysUpdateRoomServerImage
Updates the Docker image for the specified room server configuration. Automatically increments the server config version.

| Service | Operation |
| ------- | --------- |
| roomServer | SYS_UPDATE_ROOM_SERVER_IMAGE |

## Method Parameters
Parameter | Description
--------- | -----------
serverName | The name of the room server config to update, as defined in App > Design > Servers > My Servers.
dockerRepository | The new Docker repository string (e.g. 'myorg/my-game-server:v1.2.3').

## 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 serverName = "my-server-type";
var dockerRepository = "myorg/my-game-server:v1.2.3";
var roomServerProxy = bridge.getRoomServerServiceProxy();

var postResult = roomServerProxy.sysUpdateRoomServerImage(serverName, dockerRepository);
```

**Raw:**

```r
{
    "service":"roomServer",
    "operation":"SYS_UPDATE_ROOM_SERVER_IMAGE",
    "data":{
        "serverName":"my-server-type",
        "dockerRepository":"myorg/my-game-server:v1.2.3"
    }
}
```

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

```json
{
  "data": {
    "dockerRepository": "braincloud/warstone-server:4.5.0",
    "serverName": "RoomServer",
    "version": 3
  },
  "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/roomserver/index.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/roomserver -->

# RoomServer

**RoomServer** service allows devs to directly launch hosted servers without going through lobby matchmaking.

### API Summary

-   [SysGetRoomMember](/api/capi/roomserver/sysgetroommember) - Used to retrieve the details of the given room member.
-   [SysLaunchServer](/api/capi/roomserver/syslaunchserver) - Launch a hosted server directly. Allows for the bypassing of brainCloud lobby matchmaking.
-   [SysRoomEvent](/api/capi/roomserver/sysroomevent) - Arbitrary method for calling the script associated with a directly launched hosted server instance.
-   [SysRoomReady](/api/capi/roomserver/sysroomready) - Indicates that a room is ready for use by the members.
-   [SysRoomSessionEnded](/api/capi/roomserver/sysroomsessionended) - Indicates that the given server instance has ended.
-   [SysRoomSessionStarted](/api/capi/roomserver/sysroomsessionstarted) - Indicates that the given server instance has started.
-   [SysUpdateRoomServerImage](/api/capi/roomserver/sysupdateroomserverimage) - Updates the Docker image for the specified room server configuration. Automatically increments the server config version.

> **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 roomserver APIs (if they are not listed at this section),
> refer to brainCloud client [roomserver](/api/capi/roomserver) APIs.
