View Source Lobby messages

PubSub messages sent out in relation to changes to lobbies.

Teiserver.Game.GlobalLobby

Messages for everybody for discoverability of lobbies.

Open - :lobby_opened

Closed - :lobby_closed

  • :lobby_id - The id of the lobby closed
%{
  event: :lobby_closed,
  lobby_id: Lobby.id()
}

Teiserver.Game.Lobby:{lobby_id}

Messages relating to updates to the lobby in question.

User joined - :lobby_user_joined

Fired off whenever a user is added to the lobby member list.

  • :client - A Teiserver.Connections.Client of the client
  • :shared_secret - A string used to identify clients to the game host (since the in-game connection will be separate from the server). Though this value is broadcast to all subscribers it should only be forwarded to the host and relevant user.
%{
  event: :lobby_user_joined,
  lobby_id: Lobby.id(),
  client: Client.t(),
  shared_secret: String.t()
}

User left - :lobby_user_left

Indicating a user has left the lobby

  • :user_id - The user_id of the leaver
%{
  event: :lobby_user_left,
  lobby_id: Lobby.id(),
  user_id: User.id()
}

Message received - :message_received

A message has been sent in the match chat.

%{
  event: :message_received,
  lobby_id: Lobby.id(),
  match_message: MatchMessage.t()
}

Client state change - :lobby_client_change

Note this will be sent in addition to normal client updated messages but by doing this we prevent people having to subscribe/unsubscribe from client update messages.

  • :update_id - An incremental number to allow for out of order messages
  • :changes - A map of the changes to the client
%{
  event: :client_updated,
  update_id: integer(),
  user_id: User.id(),
  changes: map()
}

State update - :lobby_updated

  • :update_id - An incremental number to allow for out of order messages
  • :changes - A map of the changes to the lobby
%{
  event: :lobby_updated,
  lobby_id: Lobby.id(),
  update_id: integer(),
  changes: map()
}

Closed - :lobby_closed

  • :lobby_id - The id of the lobby closed
%{
  event: :lobby_closed,
  lobby_id: Lobby.id()
}

Teiserver.Game.LobbyHost:{lobby_id}

Messages specifically for hosting of the lobby. Separate from client related ones to allow for observability and greater control for users of the library.

User requests to join - :join_request