Skip to content

Lobbies

Adding multiple users in a session works by invoking the lobbies API.

A LobbyId connects multiple user sessions together to display a multiplayer experience.

When multiple sessions have the same LobbyId, it allows our system to logically group these sessions together with minimal client side effort.

We support this feature in both Unity and Unreal

An example implementation for Unity is as follows:

Request unique LobbyId from Cognitive3D API:

// Unity game server example code:
class LobbyResponse
{
    public string id;
}

IEnumerator GetLobbyId(string APIKey)
{   
    // Post to Lobbies API
    using (UnityWebRequest www = UnityWebRequest.Post("https://data.cognitive3d.com/v0/lobbies",""))
    {
        // Add Project APIKey to header
        www.SetRequestHeader("Authorization", "APIKEY:DATA " + APIKey);
        yield return www.SendWebRequest();

        // Get response
        LobbyResponse lobbyresponse = JsonUtility.FromJson<LobbyResponse>(www.downloadHandler.text);
    }
}

Set LobbyId for each client:

// Game client
CognitiveVR_Manager.SetLobbyId(lobbyid);

intercom If you have a question or any feedback about our documentation please use the Intercom button in the lower right corner of any web page.