Add docs and types for the game.join event
This commit is contained in:
parent
885c9c9e71
commit
3b5e643232
3 changed files with 31 additions and 1 deletions
|
|
@ -9,5 +9,6 @@ export * from "./types/PlayerData";
|
|||
// Server-Client Communications
|
||||
export * from "./types/ServerResponse";
|
||||
export * from "./types/events/SaveShip";
|
||||
export * from "./types/events/game_join";
|
||||
export * from "./types/events/server_info";
|
||||
export * from "./types/events/game_create";
|
||||
13
common/src/types/events/game_join.ts
Normal file
13
common/src/types/events/game_join.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { ServerResponse } from "../ServerResponse";
|
||||
import { PlayerData } from "../PlayerData";
|
||||
|
||||
/** The data required by the server to be able to join a game */
|
||||
export interface IGameJoinRequest {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** The response that the player receives upon succesfully joining a game. */
|
||||
export interface IGameJoinResponse extends ServerResponse {
|
||||
players?: PlayerData[];
|
||||
}
|
||||
|
|
@ -39,4 +39,20 @@ Creates a new game lobby for players to be able to join.
|
|||
### Payload Types:
|
||||
Request Payload: `IGameCreateRequest`
|
||||
|
||||
Response Payload: `IGameCreateResponse`
|
||||
Response Payload: `IGameCreateResponse`
|
||||
|
||||
---
|
||||
|
||||
## `game.join`
|
||||
Joins the user into a game, the game must be in the lobby in order to join into
|
||||
it.
|
||||
|
||||
### Supported Event Types
|
||||
| Request | Response | Broadcasted
|
||||
| ------- | -------- | -----------
|
||||
| Yes | Yes | No
|
||||
|
||||
### Payloads
|
||||
Request Payload: `IGameJoinRequest`
|
||||
|
||||
Response Payload: `IGameJoinResponse`
|
||||
Loading…
Add table
Add a link
Reference in a new issue