From 83934e9c1916bf5de32689bcc19673705b804ff5 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Tue, 15 Dec 2020 21:48:51 -0700 Subject: [PATCH] Begin on planning all of the Websocket events and their data payloads. --- server/events.md | 117 +++++++++++++++++++++++++++++++++++++++++++++++ server/types.md | 6 +++ 2 files changed, 123 insertions(+) create mode 100644 server/events.md create mode 100644 server/types.md diff --git a/server/events.md b/server/events.md new file mode 100644 index 0000000..0274ca6 --- /dev/null +++ b/server/events.md @@ -0,0 +1,117 @@ +# Properties Of All Response Payloads +| Property | Type | Description +| -------- | ---- | ----------- +| success | Boolean | Whether the player joined the team successfully. +| message? | String | More information relating to the response. This is set iff `success` is `false`. + +

+--- + +# `CreateGame`: + +## Event Description: +Triggered when a user is creating a game. + +## Request Payload: +| Property | Type | Description +| -------- | ---- | ----------- +| name | String | The name of the person starting the game + +## Response Payload: (`GameCreated`) +| Property | Type | Description +| -------- | ---- | ----------- +| id | String | The user's game ID, this should be stored to permit users to re-join the game if they get disconnected. +| game_code | String | The game's code that other players can use to connect to the game. + +

+--- + +# `JoinGame`: + +## Description: +Triggered by the client when it attempts to connect to a game. + +## Request Payload: +| Property | Type | Description +| -------- | ---- | ----------- +| name | String | The user's name +| game_code | String | The game code for the game the user is trying to join. +| id? | String | The user's ID that was stored if they have already joined a game and not finished it. + +## Response Payload: (`GameJoined`) +| Property | Type | Description +| -------- | ---- | ----------- +| id | String | The user's game ID, if `id` is set in the payload, this is the same, otherwise it is a brand new ID. + +

+--- + +# `JoinTeam`: + +## Description: +This event is triggered by the client when the user attempts to join a team from the lobby. + +## Request Payload: +| Property | Type | Description +| -------- | ---- | ----------- +| team | int | The team to join. Accepted values are: `1`, and `2`, any other value will throw an error. +| role | String | The role the player is assuming. This can be `"writer"` or `"guesser"`, any other value will throw an error. + +## Response Payload: (`JoinTeam`) +| Property | Type | Description +| -------- | ---- | ----------- + +

+--- + +# `PlayerUpdate`: + +## Description: +This event is sent from the server and is a result of a player joining/changing team. + +## Request Payload: +The client cannot send this event and only receives it. + +## Response Payload: +| Property | Type | Description +| -------- | ---- | ----------- +| player | Player | The player's new data. + +

+--- + +# ``: + +## Description: + + +## Request Payload: +| Property | Type | Description +| -------- | ---- | ----------- + + +## Response Payload: (``) +| Property | Type | Description +| -------- | ---- | ----------- + + +

+--- + +# ``: + +## Description: + + +## Request Payload: +| Property | Type | Description +| -------- | ---- | ----------- + + +## Response Payload: (``) +| Property | Type | Description +| -------- | ---- | ----------- + + +

+--- \ No newline at end of file diff --git a/server/types.md b/server/types.md new file mode 100644 index 0000000..b7c035b --- /dev/null +++ b/server/types.md @@ -0,0 +1,6 @@ +## Player: +| Property | Type | Description +| -------- | ---- | ----------- +| name | String | The player's name. +| role | String | The player's role. This will be one of `"guesser"` or `"writer"`. +| team | Integer | The player's team. This will be one of `1` or `2` \ No newline at end of file