Update/add file headers for documentation purposes

This commit is contained in:
Oliver-Akins 2020-09-30 23:49:10 -06:00
parent d204378ea5
commit 1380a7919b
3 changed files with 16 additions and 2 deletions

View file

@ -1,6 +1,9 @@
/* /*
Get's the current player list. This is only really used by the host. This is Get's the current player list. This is only really used by the host. This is
almost never called by the client itself almost never called by the client itself
Emissions:
PlayerListResponse->sender - Sends the list of players to the client
*/ */
import * as db from '../utils/db'; import * as db from '../utils/db';
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';

View file

@ -3,8 +3,9 @@ Starts a game on the server, this also acts as the `JoinGame` event for the
host, except that it doesn't send any events out to other players as there host, except that it doesn't send any events out to other players as there
are none yet. are none yet.
This will also emit the `HostInformation` event to the host client, which will Emissions:
allow us to send them information about what the game code is HostInformation - Data containing if the game created successfully or not
and the game code for the game if it was successful.
Client Side: After the host receives the `HostInformation` event, the Query Client Side: After the host receives the `HostInformation` event, the Query
String parameters should be updated with the Websocket URI and the game code so String parameters should be updated with the Websocket URI and the game code so

View file

@ -1,3 +1,13 @@
/*
Connects to an already existing game on the server.
Emissions:
NewPlayer->A!sender - This event is sent to other players who are in
the lobby to allow them to update their view so that they see all the
players in the lobby at all times.
GameJoined->sender - Sent to the client to tell them the current list of
players and that they were added to the game either successfully or not
*/
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const JoinGame = (socket: Socket, data: JoinGame) => { export const JoinGame = (socket: Socket, data: JoinGame) => {
console.log(`User: ${data.username} (${data.game_code})`); console.log(`User: ${data.username} (${data.game_code})`);