Skip to content
Nandha Kishore edited this page Mar 29, 2020 · 3 revisions

Welcome to the backend.cards.io wiki!

Socket Channels

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.

create

  • Params

    • Player Name: name [string] [Required]
    • Player ID: pid [string] [Optional]
  • Success Response:

    • Channel: game-updates [Private]
      Body: { code: 200, type: 'CREATE', gcode: [string], pid: [string], pname: [string] }

probe

  • Params

    • Game Code: code [string] [Required]
  • Success Response:

    • Channel: game-probe [Private]
      Body: { code: 200, data: [ { name: [string], position: [number] } ] }

join

  • Params

    • Game Code: code [string] [Required]
    • Player Name: name [string] [Required]
    • Player Position: position [number] [Required]
    • Player ID: pid [string] [Optional]
  • 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] } ] }

leave

  • Params

    • Game Code: code [string] [Required]
    • Player ID: pid [string] [Required]
  • Success Response:

    • Channel: game-updates [Room]
      Body: { code: 200, type: 'LEAVE', pname: [string], position: [number] }

start

  • Params

    • Game Code: code [string] [Required]
    • Player ID: pid [string] [Required]
  • Success Response:

    • Channel: game-updates [Room]
      Body: { code: 200, type: 'START' }

destroy

  • Params
    • Game Code: code [string] [Required]
    • Player ID: pid [string] [Required]

game-data

  • Success Response:
    • Channel: game-data [Room]
      Body: { type: 'GAME', data: [Game] }

player-data

  • Success Response:
    • Channel: player-data [Private]
      Body: { type: 'PLAYER', data: [Player] }

Game Logs

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]

Clone this wiki locally