Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Latest commit

 

History

History
282 lines (194 loc) · 13.6 KB

README.md

File metadata and controls

282 lines (194 loc) · 13.6 KB

lobbyV2

Overview

Operations to create and manage lobbies.

Available Operations

CreateLobby

Create a new lobby for an existing application using appId.

Example Usage

using Hathora;
using Hathora.Models.Operations;
using Hathora.Models.Shared;

var sdk = new HathoraSDK(
    appId: "app-af469a92-5b45-4565-b3c4-b79878de67d2"
);

using(var res = await sdk.LobbyV2.CreateLobbyAsync(new Models.Operations.CreateLobbyRequest() {
        CreateLobbyRequest = new Models.Shared.CreateLobbyRequest() {
            InitialConfig = new LobbyInitialConfig() {},
            Region = Hathora.Models.Shared.Region.London,
            Visibility = Hathora.Models.Shared.LobbyVisibility.Private,
        },
        RoomId = "2swovpy1fnunu",
    }))
{
    // handle response
}

Parameters

Parameter Type Required Description
request Models.Operations.CreateLobbyRequest ✔️ The request object to use for the request.

Response

CreateLobbyResponse

CreateLocalLobby

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

using Hathora;
using Hathora.Models.Operations;
using Hathora.Models.Shared;

var sdk = new HathoraSDK(
    appId: "app-af469a92-5b45-4565-b3c4-b79878de67d2"
);

using(var res = await sdk.LobbyV2.CreateLocalLobbyAsync(new CreateLocalLobbyRequest() {
        RequestBody = new CreateLocalLobbyRequestBody() {
            InitialConfig = new LobbyInitialConfig() {},
            Region = Hathora.Models.Shared.Region.Frankfurt,
        },
        RoomId = "2swovpy1fnunu",
    }))
{
    // handle response
}

Parameters

Parameter Type Required Description
request CreateLocalLobbyRequest ✔️ The request object to use for the request.

Response

CreateLocalLobbyResponse

CreatePrivateLobby

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

using Hathora;
using Hathora.Models.Operations;
using Hathora.Models.Shared;

var sdk = new HathoraSDK(
    appId: "app-af469a92-5b45-4565-b3c4-b79878de67d2"
);

using(var res = await sdk.LobbyV2.CreatePrivateLobbyAsync(new CreatePrivateLobbyRequest() {
        RequestBody = new CreatePrivateLobbyRequestBody() {
            InitialConfig = new LobbyInitialConfig() {},
            Region = Hathora.Models.Shared.Region.Chicago,
        },
        RoomId = "2swovpy1fnunu",
    }))
{
    // handle response
}

Parameters

Parameter Type Required Description
request CreatePrivateLobbyRequest ✔️ The request object to use for the request.

Response

CreatePrivateLobbyResponse

CreatePublicLobby

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

using Hathora;
using Hathora.Models.Operations;
using Hathora.Models.Shared;

var sdk = new HathoraSDK(
    appId: "app-af469a92-5b45-4565-b3c4-b79878de67d2"
);

using(var res = await sdk.LobbyV2.CreatePublicLobbyAsync(new CreatePublicLobbyRequest() {
        RequestBody = new CreatePublicLobbyRequestBody() {
            InitialConfig = new LobbyInitialConfig() {},
            Region = Hathora.Models.Shared.Region.Sydney,
        },
        RoomId = "2swovpy1fnunu",
    }))
{
    // handle response
}

Parameters

Parameter Type Required Description
request CreatePublicLobbyRequest ✔️ The request object to use for the request.

Response

CreatePublicLobbyResponse

GetLobbyInfo

Get details for an existing lobby using appId and roomId.

Example Usage

using Hathora;
using Hathora.Models.Operations;

var sdk = new HathoraSDK(
    appId: "app-af469a92-5b45-4565-b3c4-b79878de67d2"
);

using(var res = await sdk.LobbyV2.GetLobbyInfoAsync(new GetLobbyInfoRequest() {
        RoomId = "2swovpy1fnunu",
    }))
{
    // handle response
}

Parameters

Parameter Type Required Description
request GetLobbyInfoRequest ✔️ The request object to use for the request.

Response

GetLobbyInfoResponse

ListActivePublicLobbies

Get all active lobbies for a given application using appId. Filter the array by optionally passing in a region.

Example Usage

using Hathora;
using Hathora.Models.Operations;
using Hathora.Models.Shared;

var sdk = new HathoraSDK(
    appId: "app-af469a92-5b45-4565-b3c4-b79878de67d2"
);

using(var res = await sdk.LobbyV2.ListActivePublicLobbiesAsync(new ListActivePublicLobbiesRequest() {
        Region = Hathora.Models.Shared.Region.Seattle,
    }))
{
    // handle response
}

Parameters

Parameter Type Required Description
request ListActivePublicLobbiesRequest ✔️ The request object to use for the request.

Response

ListActivePublicLobbiesResponse

SetLobbyState

Set the state of a lobby using appId and roomId. State is intended to be set by the server and must be smaller than 1MB.

Example Usage

using Hathora;
using Hathora.Models.Operations;
using Hathora.Models.Shared;

var sdk = new HathoraSDK(
    appId: "app-af469a92-5b45-4565-b3c4-b79878de67d2"
);

using(var res = await sdk.LobbyV2.SetLobbyStateAsync(new SetLobbyStateSecurity() {
        HathoraDevToken = "",
    }, new Models.Operations.SetLobbyStateRequest() {
        SetLobbyStateRequest = new Models.Shared.SetLobbyStateRequest() {
            State = new SetLobbyStateRequestState() {},
        },
        RoomId = "2swovpy1fnunu",
    }))
{
    // handle response
}

Parameters

Parameter Type Required Description
request Models.Operations.SetLobbyStateRequest ✔️ The request object to use for the request.
security SetLobbyStateSecurity ✔️ The security requirements to use for the request.

Response

SetLobbyStateResponse