-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Nandha Kishore edited this page Mar 29, 2020
·
3 revisions
Welcome to the backend.cards.io wiki!
This section describes the common socket channels that all games use. These channels are used for setting up a game and contains no information specific to the type of game hosted. However these channels will have to be implemented separately for each game implementation.
-
Params
-
Player Name:
name [string]
[Required] -
Player ID:
pid [string]
[Optional]
-
Player Name:
-
Success Response:
-
Channel: game-updates [Private]
Body:{ code: 200, type: 'CREATE', gcode: [string], pid: [string], pname: [string] }
-
Channel: game-updates [Private]
-
Params
-
Game Code:
code [string]
[Required]
-
Game Code:
-
Success Response:
-
Channel: game-probe [Private]
Body:{ code: 200, data: [ { name: [string], position: [number] } ] }
-
Channel: game-probe [Private]
-
Params
-
Game Code:
code [string]
[Required] -
Player Name:
name [string]
[Required] -
Player Position:
position [number]
[Required] -
Player ID:
pid [string]
[Optional]
-
Game Code:
-
Success Response:
-
Channel: game-updates [Room]
Body:{ code: 200, type: 'JOIN', pname: [string], position: [number] }
-
Channel: game-updates [PRIVATE]
Body:{ code: 200, type: 'LIST', data: [ { name: [string], position: [number] } ] }
-
Channel: game-updates [Room]
-
Params
-
Game Code:
code [string]
[Required] -
Player ID:
pid [string]
[Required]
-
Game Code:
-
Success Response:
-
Channel: game-updates [Room]
Body:{ code: 200, type: 'LEAVE', pname: [string], position: [number] }
-
Channel: game-updates [Room]
-
Params
-
Game Code:
code [string]
[Required] -
Player ID:
pid [string]
[Required]
-
Game Code:
-
Success Response:
-
Channel: game-updates [Room]
Body:{ code: 200, type: 'START' }
-
Channel: game-updates [Room]
-
Params
-
Game Code:
code [string]
[Required] -
Player ID:
pid [string]
[Required]
-
Game Code:
-
Success Response:
-
Channel: game-data [Room]
Body:{ type: 'GAME', data: [Game] }
-
Channel: game-data [Room]
-
Success Response:
-
Channel: player-data [Private]
Body:{ type: 'PLAYER', data: [Player] }
-
Channel: player-data [Private]
This section describes the common game logs that all games use.
Create
CREATE:[OwnerName]
Join
JOIN:[PlayerName]
Leave
LEAVE:[PlayerName]
Start
START
Game Over
WINNER:[WinnerName]
WINNER:[WinnerOne]/[WinnerTwo]/[WinnerThree]