diff --git a/docs/events.md b/docs/events.md index 8744b47..268ee2e 100644 --- a/docs/events.md +++ b/docs/events.md @@ -11,6 +11,9 @@ clients connected to the server may trigger the server in such a way that the event response gets sent to multiple clients. **Broadcasted events will use the** `res` **event type prefix.** +Most request payload types inherit from `ServerRequest`, and all response +payloads inherit from the `ServerResponse` type. + --- ## `server.info` @@ -29,8 +32,26 @@ Response Payload: `IServerInfo` --- -## `event name` -event description +## `lobby.info` +Retrieves information about the lobby. In order for this event to return without +error, the client requesting the information **must** be in the lobby already. +This event is broadcasted to clients who are already in the lobby when the +player list or a player's design gets updated. + +### Supported Event Types +| Request | Response | Broadcasted +| ------- | -------- | ----------- +| Yes | Yes | Yes + +### Payloads +Request Payload: `IGetLobbyInfo` + +Response Payload: `ILobbyInfo` + +--- + +## `lobby.create` +Creates a game lobby that allows for online play. ### Supported Event Types | Request | Response | Broadcasted @@ -38,6 +59,71 @@ event description | Yes | Yes | No ### Payloads -Request Payload: `Itype name` +Request Payload: `ICreateLobby` -Response Payload: `Itype name` \ No newline at end of file +Response Payload: `ILobbyInfo` + +--- + +## `lobby.delete` +Deletes the game lobby, clearing all players from the lobby and preventing +others from joining the lobby. This endpoint errors whenever a client that isn't +the host tries to call the endpoint. + +### Supported Event Types +| Request | Response | Broadcasted +| ------- | -------- | ----------- +| Yes | Yes | Yes + +### Payloads +Request Payload: `IDeleteLobby` + +Response Payload: `ServerResponse` + +--- + +## `lobby.players.join` +Allows a player to join a lobby based on the lobby identifier. + +### Supported Event Types +| Request | Response | Broadcasted +| ------- | -------- | ----------- +| Yes | Yes | No, causes `lobby.info` broadcast + +### Payloads +Request Payload: `IJoinLobby` + +Response Payload: `ILobbyInfo` + +--- + +## `lobby.players.leave` +This allows non-host players to leave the lobby without destroying it entirely. +This endpoint errors when the client that created the lobby attempts to use the +endpoint. + +### Supported Event Types +| Request | Response | Broadcasted +| ------- | -------- | ----------- +| Yes | Yes | No, causes `lobby.info` broadcast + +### Payloads +Request Payload: `ILeaveLobby` + +Response Payload: `ServerResponse` + +--- + +## `lobby.players.update` +Allows the player to update their own information, this is primarily used for +updating the ship design. + +### Supported Event Types +| Request | Response | Broadcasted +| ------- | -------- | ----------- +| Yes | Yes | No, causes `lobby.info` broadcast + +### Payloads +Request Payload: `IUpdatePlayer` + +Response Payload: `ServerResponse`