Docs: Add new get_lobby_list command
This commit is contained in:
@@ -50,6 +50,12 @@ This document describes the protocol for client-server communication in our appl
|
||||
- [Error Response](#error-response-6)
|
||||
- [Example Request](#example-request-4)
|
||||
- [Example Response](#example-response-4)
|
||||
- [GET_LOBBY_LIST command](#get_lobby_list-command)
|
||||
- [Required pre-execution checks](#required-pre-execution-checks)
|
||||
- [Request Parameters](#request-parameters)
|
||||
- [Success Response](#success-response)
|
||||
- [Example Request](#example-request)
|
||||
- [Example Response](#example-response)
|
||||
|
||||
<!-- Please see the comments for copy ‚ n' paste ready examples -->
|
||||
|
||||
@@ -515,6 +521,60 @@ END
|
||||
END
|
||||
```
|
||||
|
||||
## GET_LOBBY_LIST command
|
||||
|
||||
The `GET_LOBBY_LIST` command requests the server to return a list of currently available lobbies with basic metadata.
|
||||
|
||||
### Required pre-execution checks
|
||||
None.
|
||||
|
||||
### Request Parameters
|
||||
No parameters.
|
||||
|
||||
### Implementation notes
|
||||
|
||||
- Parser: `GetLobbyListParser` — creates `GetLobbyListRequest` (no parameters).
|
||||
- Handler: `GetLobbyListHandler` — queries `LobbyManager#getAllLobbies()` and returns `GetLobbyListResponse`.
|
||||
- Response: `GetLobbyListResponse` — builds a `LOBBIES` collection with repeated `LOBBY` blocks containing `ID`, `NAME`, `PLAYER_COUNT`.
|
||||
|
||||
### Success Response
|
||||
|
||||
The response contains a `LOBBIES` collection with nested `LOBBY` entries.
|
||||
|
||||
Example response structure:
|
||||
|
||||
```
|
||||
+OK
|
||||
LOBBIES
|
||||
LOBBY
|
||||
ID=1
|
||||
NAME=Room 1
|
||||
PLAYER_COUNT=2
|
||||
END
|
||||
LOBBY
|
||||
ID=2
|
||||
NAME=Room 2
|
||||
PLAYER_COUNT=3
|
||||
END
|
||||
END
|
||||
END
|
||||
```
|
||||
|
||||
### Example Request
|
||||
|
||||
```
|
||||
GET_LOBBY_LIST
|
||||
```
|
||||
|
||||
### Example Response (error)
|
||||
|
||||
```
|
||||
-ERR
|
||||
CODE=NO_LOBBIES_AVAILABLE
|
||||
MESSAGE=No lobbies available
|
||||
END
|
||||
```
|
||||
|
||||
## GET_LOBBY_STATUS command
|
||||
|
||||
The `GET_LOBBY_STATUS` command requests the server to return the current state of a lobby, including the list of players and their ready state.
|
||||
|
||||
Reference in New Issue
Block a user