Skip to main content
Version: 3.3

class RoomManagementService

(Niantic.Lightship.SharedAR.Rooms.RoomManagementService)

Overview

The RoomManagementService provides interface to access Room Management Service backend to create, remove, find Rooms. A room is an entity to connect multiple peers through server relayed network.

class RoomManagementService {
public:

struct GetOrCreateRoomAsyncTaskResult;

// methods

static RoomManagementServiceStatus CreateRoom(
RoomParams roomParams,
out IRoom outRoom
);

static RoomManagementServiceStatus DeleteRoom(string roomId);
static RoomManagementServiceStatus GetRoom(string roomId, out IRoom outRoom);

static RoomManagementServiceStatus QueryRoomsByName(
string name,
out List<IRoom> rooms
);

static RoomManagementServiceStatus GetAllRooms(out List<IRoom> rooms);

static RoomManagementServiceStatus GetOrCreateRoomForName(
RoomParams roomParams,
out IRoom outRoom
);

static void GetOrCreateRoomAsync(
string roomName,
string roomDesc,
uint roomCapacity,
GetOrCreateRoomCallback doneCb
);

static async Task<GetOrCreateRoomAsyncTaskResult> GetOrCreateRoomAsync(
string roomName,
string roomDescription,
uint roomCapacity
);

delegate void GetOrCreateRoomCallback(
RoomManagementServiceStatus status,
string room_id
);
};

Detailed Documentation

The RoomManagementService provides interface to access Room Management Service backend to create, remove, find Rooms. A room is an entity to connect multiple peers through server relayed network.

Methods

CreateRoom

static RoomManagementServiceStatus CreateRoom(
RoomParams roomParams,
out IRoom outRoom
)

Create a new room on the server.

    Parameters:

    roomParams - Parameters of the room

    outRoom - Created room as IRoom object. null if failed to create.

    Returns:

    Status of the operation

DeleteRoom

static RoomManagementServiceStatus DeleteRoom(string roomId)

Delete a room on the server.

    Parameters:

    roomId - Room ID of the room to delete

    Returns:

    Status of the operation

GetRoom

static RoomManagementServiceStatus GetRoom(string roomId, out IRoom outRoom)

Get a room by Room ID on the server

    Parameters:

    roomId - Room ID as a string

    outRoom - Found Room object. Null if operation failed or room ID not found<//param>

    Returns:

    Status of the operation

QueryRoomsByName

static RoomManagementServiceStatus QueryRoomsByName(
string name,
out List<IRoom> rooms
)

Query room(s) by name on the server

    Parameters:

    name - Name of the room to find

    rooms - A List of rooms which has matching name

    Returns:

    Status of the operation

GetAllRooms

static RoomManagementServiceStatus GetAllRooms(out List<IRoom> rooms)

Get all rooms on the server, which was created by this app

    Parameters:

    rooms - List of rooms available for this app

    Returns:

    Status of the operation

GetOrCreateRoomForName

static RoomManagementServiceStatus GetOrCreateRoomForName(
RoomParams roomParams,
out IRoom outRoom
)

Get a IRoom object that has a given name on the server. If no room found with the name, create a new room using given room parameters

    Parameters:

    roomParams - Room parameters of the room to get or create

    outRoom - IRoom object. null if server operarion failed

    Returns:

    Status of the operation

GetOrCreateRoomAsync

static void GetOrCreateRoomAsync(
string roomName,
string roomDesc,
uint roomCapacity,
GetOrCreateRoomCallback doneCb
)

An async implementation of the GetOrCreateRoom request. This function checks to see if any rooms of the name "roomName" exist and if not, it creates the room. Once the function has a valid RoomID from either of these operations, it returns it via the "doneCb". The "doneCb" has two parameters. The first is a response code in case there are service issues, and the second parameter is the room id that was found/created.

    Parameters:

    roomName - Room name to check for

    roomDesc - Room description to use if a room needs to be made

    roomCapacity - Room capacity to use if a room needs to be made

    doneCb - Callback that the function calls after it errors or receives a valid room id.

GetOrCreateRoomAsync

static async Task<GetOrCreateRoomAsyncTaskResult> GetOrCreateRoomAsync(
string roomName,
string roomDescription,
uint roomCapacity
)

An async implementation of the GetOrCreateRoom request. This function checks to see if any rooms of the name "roomName" exist and if not, it creates the room. This variant returns a Task so it can be await -ed by C#'s async/await feature. The task is given two results, the status of the request and, if successful, the roomId for the request.

    Parameters:

    roomName - Room name to check for

    roomDescription - Room description to use if a room needs to be made

    roomCapacity - Room capacity to use if a room needs to be made

    Returns:

    Task with the request status and the roomId on successful requests