Lobbies

Note

Stability: 2 - Unstable

Overview

Lobbies are persistent, long term, places where groups of users can gather and have real time chat sessions with each other. Each lobby is backed by a pre-defined lobby template that controls the behavior of that lobby.

Lobbies are persistent and must be manually deleted when you are done with them. Chat messages are not persistent and will be lost whenever the chat room becomes empty.

The Lobby Object

{
    'cluster': u'local',
    'created_at': '2014-06-05 14:33:19',
    'created_by': '5102a78ae2c6625ed0000000',
    'data': {
        'welcome_message': 'Welcome to Example Chat. gl hf'
    },
    'id': '53907faf44b4ac1979f9027f',
    'name': 'Example Lobby',
    'slug': 'example-lobby',
    'template_slug': 'docs-example',
    'updated_at': '2014-06-05 14:42:33'
}

Each lobby has the following attributes:

name :
The name of your lobby. No unique requirements.
slug :
[Optional] Human-readable unique identifier for your lobby. A slug cannot be edited once it has been set.
cluster :
The realtime server cluster that hosts this lobby. Defaults to cluster from current realtime connection for user requests.
template_slug :
The slug of the template to base this lobby on.
created_by :
The id of the user that created the lobby; Automatically derived from the authenticated user. Lobbies created by administrators on the Hydra developer site have created_by=None.
created_at :
Date on which the lobby was created.
updated_at :
Date on which the lobby was last updated.

Creating

You need a valid lobby template slug and a lobby name to create a new lobby. If the template slug is invalid or requires administrator privileges this request will fail.

  • client.Lobby.CreateNew(templateSlug, lobbyName, delegate(Lobby lobby, Request req)
    {
        // ...
    });
    
  • client->getLobbiesService().createNew(templateSlug, lobbyName, [] (hydra::shared_ptr<Lobby> lobby, Request* request) {
        //...
    });
    
  • client.getLobbiesService().createNew(templateSlug, lobbyName, new ObjectListener<Lobby>() {
        @Override
        public void objectReceived(Lobby lobby, Response r) {
            //...
        }
    });
    
  • Not supported.
  • Documentation coming soon.

Finding

  • // Load the first page of all lobbies
    client.Lobby.LoadLobbies(delegate(PagedResult<Lobby> result, Request req)
    {
        // ...
    });
    
    // Load the second page of 'ExampleTemplate' lobbies
    LobbyListOptions options = new LobbyListOptions() { Page=2, Count=20, TemplateSlug="ExampleTemplate" };
    client.Lobby.LoadLobbies(options, delegate(PagedResult<Lobby> result, Request req)
    {
        // ...
    });
    
  • // Load the first page of all lobbies
    client->getLobbiesService().loadLobbies([] (const PagedSharedPtrResult<Lobby>& lobbies, Request* request) {
        //...
    });
    
    // Load the second page of 'ExampleTemplate' lobbies
    LobbyListOptions options;
    options.setPage(2).setCount(20).setTemplate("ExampleTemplate");
    client->getLobbiesService().loadLobbies(options, [] (const PagedSharedPtrResult<Lobby>& lobbies, Request* request) {
        //...
    });
    
  • // Load the first page of all lobbies
    client.getLobbiesService().loadLobbies(new PagedObjectListListener<Lobby>() {
        @Override
        public void objectReceived(PagedResult<Lobby> lobbies, Response r) {
            //...
        }
    });
    
    // Load the second page of 'ExampleTemplate' lobbies
    LobbyListOptions options = new LobbyListOptions();
    options.setPage(2).setCount(20).setTemplate("ExampleTemplate");
    client.getLobbiesService().loadLobbies(options, new PagedObjectListListener<Lobby>() {
        @Override
        public void objectReceived(PagedResult<Lobby> lobbies, Response r) {
            //...
        }
    });
    
  • Not supported.
  • Documentation coming soon.

Using

In order to start sending and receiving messages on a lobby you must first join the associated realtime chat session.

Joining

  • lobby.JoinChatSession();
    
  • lobby->JoinChatSession();
    
  • lobby.joinChatSession();
    
  • Not supported.
  • Documentation coming soon.

Sending Messages

All messages are sent to all lobby users. No private messaging.

  • lobby.ChatLogic.SendMessage("Example chat message.");
    
  • lobby->getChatLogic()->sendMessage("Example chat message.");
    
  • lobby.getChatLogic().sendMessage("Example chat message.");
    
  • Not supported.
  • Documentation coming soon.

Receiving Messages

  • lobby.ChatLogic.ChatMessageReceived += new LobbyChatLogic.ChatMessageHandler(delegate(ChatMessage message)
    {
        //...
    })
    
  • lobby->getChatLogic()->ChatMessageReceived.add("handler", [](const hydra::shared_ptr<ChatMessage> message) {
        //...
    });
    
  • lobby.getChatLogic().addLogicListener(new LobbyChatLogic.LobbyChatLogicListener() {
        @Override
        public void onChatMessageReceived(ChatMessage message) {
            //...
        }
    });
    
  • Not supported.
  • Documentation coming soon.

Leaving

  • lobby.LeaveChatSession();
    
  • lobby->leaveChatSession();
    
  • lobby.leaveChatSession();
    
  • Not supported.
  • Documentation coming soon.

The ChatMessage Object

Identity :
The Identity of the user that sent the message
Message :
The string contents of the message that was sent.
Time:
The time the chat message was sent to Hydra.

Table Of Contents

Previous topic

Lobby Templates

Next topic

Match Templates