Diarkis Inc.

Top > Blog > Diarkis Room – How To List Available Rooms

Diarkis Room – How To List Available Rooms

Diarkis Room How To List Rooms

In many cases, you will want to have a list of available rooms to join.

Diarkis Room module allows you to assign a “type” to a room to be listed by the assigned “type”.

Before Going Further

Please read what Diarkis Room Module is all about before you read this.

For Room module details, please read here.

How To Register A Room With A Type

In order for a room to be “found” by its type, you must register the room with a type. The example below shows you how to do that using Diarkis C# client.

// This event is raised when the room has been registered or failed to register
room.OnRegister += HandleOnDiarkisRoomRegister;

private void HandleOnDiarkisRoomRegister(bool success, string msg)
{
    // Well yay or nay
}

// Room type to assgin to the room and this will be used to find the room
int roomType = 1;
// Room name that you want to assign to the room
string roomName = "My Awesome Room";
// Room metadata as a string for extra information
string roomMetadata = "This is my public room to be shared";
room.Register(roomType, roomName, roomMetadata);

How To Find Registered Rooms By Type

The example below demonstrates how to find a list of rooms with the same type using Diarkis C# client.

// This event is raised when a list of rooms is found or not
room.OnFindRoomsByType += HandleOnDiarkisFindRooms;

private void HandleOnDiarkisFindRooms(bool success, List<Diarkis.Modules.Room.RoomListItem> rooms)
{
    if (!success)
    {
         // Handle error
         return;
    }
    // We have a list of rooms with the same type
}

// Room type to find
int roomType = 1;
// How many rooms to find (The results may be less than this)
int limit = 10;
// OnFindRoomsByType will be raised to give us the results
room.FindRoomsByType(roomType, limit);

C# Client SDK v0.1.11 and later.

For Room module details, please read here.

Diarkis enables massive multiplayer network communications.

Contact Us
このエントリーをはてなブックマークに追加

Recommendations

If you are interested in learning more about Diarkis, please contact us here.

Contact Us Request Documents
PAGE TOP