Chess Game Service Connection 0.1.2
  • MIT
  • application/json
  • ID: https://github.com/ldss-project/chess-game-service/websocket

A service which handles the configuration, execution and termination of chess games.

This API refers to the messages that can be exchanged during the connection between a player and a specific chess game.

  • #Requests
  • #Responses
  • #Events

Servers

  • localhost:8083wslocal

    Default Local Server

Operations

  • PUB /game/connect/{gameId}/websocket

    The websocket connection between a player and a chess game.

    Interact with the chess game with the specified id.

    Operation IDplayer-to-server
    gameId
    required
    string
    uid: gameId

    the id of the chess game which the player is connected to.

    Accepts one of the following messages:

    • #0Get stateget-state

      Request the chess game to provide a snapshot of its state.

      Message IDget-state

      The state of a chess game contains information not only about the game itself, but also about the server hosting the game. In particular, a ServerState refers to all the information of a chess game, including the state of the server, possible errors, subscription and the state of the actual game, which it is referred to as GameState.

      object
      • #Requests

      Examples

    • #1Join gamejoin-game

      Join the chess game as the specified player in the specified team.

      Message IDjoin-game
      object
      • #Requests

      Examples

    • #2Find movesfind-moves

      Request the chess game to provide the available moves for the piece at the specified position.

      Message IDfind-moves
      object
      • #Requests

      Examples

    • #3Apply moveapply-move

      Request the chess game to apply the specified move.

      Message IDapply-move
      object
      • #Requests

      Examples

    • #4Promotepromote

      Request the chess game to promote the pawn which is currently awaiting for promotion to the specified promotion choice.

      Message IDpromote
      object
      • #Requests

      Examples

  • SUB /game/connect/{gameId}/websocket

    The websocket connection between a player and a chess game.

    Observe the consequences of the interactions with the chess game with the specified id.

    Operation IDserver-to-player
    gameId
    required
    string
    uid: gameId

    the id of the chess game which the player is connected to.

    Accepts one of the following messages:

    • #0Get State Responseget-state-response

      A response to the 'Get State' request from a player.

      Message IDget-state-response
      object
      • #Responses

      Examples

    • #1Join Game Responsejoin-game-response

      A response to the 'Join Game' request from a player.

      Message IDjoin-game-response
      object
      • #Responses

      Examples

    • #2Find Moves Responsefind-moves-response

      A response to the 'Find Moves' request from a player.

      Message IDfind-moves-response
      object
      • #Responses

      Examples

    • #3Apply Move Responseapply-move-response

      A response to the 'Apply Move' request from a player.

      Message IDapply-move-response
      object
      • #Responses

      Examples

    • #4Promote Responsepromote-response

      A response to the 'Promote' request from a player.

      Message IDpromote-response
      object
      • #Responses

      Examples

    • #5Chessboard Update Eventchessboard-update-event

      An event triggered when the chessboard of the game is updated.

      Message IDchessboard-update-event
      object
      • #Events

      Examples

    • #6Game Over Update Eventgame-over-update-event

      An event triggered when the game over status of the game is updated.

      Message IDgame-over-update-event

      The game over status of game, if present, tells that the game has ended and gives information about the result of the game, such as the cause of the game over and the winner of the game (if any).

      object
      • #Events

      Examples

    • #7Game Situation Update Eventgame-situation-update-event

      An event triggered when the situation of the game is updated.

      Message IDgame-situation-update-event
      object
      • #Events

      Examples

    • #8Move History Update Eventmove-history-update-event

      An event triggered when the history of the moves executed in the game is updated.

      Message IDmove-history-update-event
      object
      • #Events

      Examples

    • #9White Player Update Eventwhite-player-update-event

      An event triggered when the white player in the game is updated.

      Message IDwhite-player-update-event
      object
      • #Events

      Examples

    • #10Black Player Update Eventblack-player-update-event

      An event triggered when the black player in the game is updated.

      Message IDblack-player-update-event
      object
      • #Events

      Examples

    • #11White Timer Update Eventwhite-timer-update-event

      An event triggered when the timer of the white player in the game is updated.

      Message IDwhite-timer-update-event
      object
      • #Events

      Examples

    • #12Black Timer Update Eventblack-timer-update-event

      An event triggered when the timer of the black player in the game is updated.

      Message IDblack-timer-update-event
      object
      • #Events

      Examples

    • #13Turn Update Eventturn-update-event

      An event triggered when the current turn in the game is updated.

      Message IDturn-update-event
      object
      • #Events

      Examples

    • #14Server Error Update Eventserver-error-update-event

      An event triggered when the latest error thrown by the server hosting the chess game is updated.

      Message IDserver-error-update-event

      An error during a chess game can be one of the following:

      • GameAlreadyStartedException: a request failed because it required the game not to be started, but the game had already started.
      • GameConfiguredException: a request failed because it required the game not to be configured, but the game had already been configured.
      • GameNotReadyException: a request failed because it required the game to be ready, but the game was not.
      • GameNotRunningException: a request failed because it required the game to be running, but the game was not.
      • GameNotWaitingForPlayersException: a request failed because it required the game to be waiting for more player to join, but the game was not.
      • GameNotWaitingForPromotionException: a request failed because it required the game to be waiting for a pawn to be promoted, but the game was not.
      • GameTerminatedException: a request failed because it required the game not to be terminated, but the game had already been terminated.
      • GameWaitingForPromotionException: a request failed because it required the game not to be waiting for a pawn to be promoted, but the game was.
      • InternalServerException: an unexpected error happened during the execution of the game, probably due to the server implementation.
      • MalformedInputException: a request failed because it did not conform to the api specification of this service.
      • PlayerAlreadyExistingException: a request for joining the game failed because the team requested by the joining player had already been assigned to another player beforehand.
      object
      • #Events

      Examples

    • #15Server Situation Update Eventserver-situation-update-event

      An event triggered when the situation of the server hosting the chess game is updated.

      Message IDserver-situation-update-event

      The situation of a server hosting a chess game can be one of the following:

      • NotConfigured: the server is waiting for a game configuration to be provided.
      • WaitingForPlayers: the server is waiting for enough players to join the game.
      • Ready: the server has enough players and is waiting for a user to start the game.
      • Running: the server is executing the game, listening for the players' commands.
      • Terminated: the server is terminated due to the game ending or fatal errors.
      object
      • #Events

      Examples

    • #16Subscription Update Eventsubscription-update-event

      An event triggered when the subscriptions to the events generated by the game are updated.

      Message IDsubscription-update-event
      object
      • #Events

      Examples

Messages

  • #1Get stateget-state

    Request the chess game to provide a snapshot of its state.

    Message IDget-state

    The state of a chess game contains information not only about the game itself, but also about the server hosting the game. In particular, a ServerState refers to all the information of a chess game, including the state of the server, possible errors, subscription and the state of the actual game, which it is referred to as GameState.

    object
    • #Requests
  • #2Join gamejoin-game

    Join the chess game as the specified player in the specified team.

    Message IDjoin-game
    object
    • #Requests
  • #3Find movesfind-moves

    Request the chess game to provide the available moves for the piece at the specified position.

    Message IDfind-moves
    object
    • #Requests
  • #4Apply moveapply-move

    Request the chess game to apply the specified move.

    Message IDapply-move
    object
    • #Requests
  • #5Promotepromote

    Request the chess game to promote the pawn which is currently awaiting for promotion to the specified promotion choice.

    Message IDpromote
    object
    • #Requests
  • #6Get State Responseget-state-response

    A response to the 'Get State' request from a player.

    Message IDget-state-response
    object
    • #Responses
  • #7Join Game Responsejoin-game-response

    A response to the 'Join Game' request from a player.

    Message IDjoin-game-response
    object
    • #Responses
  • #8Find Moves Responsefind-moves-response

    A response to the 'Find Moves' request from a player.

    Message IDfind-moves-response
    object
    • #Responses
  • #9Apply Move Responseapply-move-response

    A response to the 'Apply Move' request from a player.

    Message IDapply-move-response
    object
    • #Responses
  • #10Promote Responsepromote-response

    A response to the 'Promote' request from a player.

    Message IDpromote-response
    object
    • #Responses
  • #11Chessboard Update Eventchessboard-update-event

    An event triggered when the chessboard of the game is updated.

    Message IDchessboard-update-event
    object
    • #Events
  • #12Game Over Update Eventgame-over-update-event

    An event triggered when the game over status of the game is updated.

    Message IDgame-over-update-event

    The game over status of game, if present, tells that the game has ended and gives information about the result of the game, such as the cause of the game over and the winner of the game (if any).

    object
    • #Events
  • #13Game Situation Update Eventgame-situation-update-event

    An event triggered when the situation of the game is updated.

    Message IDgame-situation-update-event
    object
    • #Events
  • #14Move History Update Eventmove-history-update-event

    An event triggered when the history of the moves executed in the game is updated.

    Message IDmove-history-update-event
    object
    • #Events
  • #15White Player Update Eventwhite-player-update-event

    An event triggered when the white player in the game is updated.

    Message IDwhite-player-update-event
    object
    • #Events
  • #16Black Player Update Eventblack-player-update-event

    An event triggered when the black player in the game is updated.

    Message IDblack-player-update-event
    object
    • #Events
  • #17White Timer Update Eventwhite-timer-update-event

    An event triggered when the timer of the white player in the game is updated.

    Message IDwhite-timer-update-event
    object
    • #Events
  • #18Black Timer Update Eventblack-timer-update-event

    An event triggered when the timer of the black player in the game is updated.

    Message IDblack-timer-update-event
    object
    • #Events
  • #19Turn Update Eventturn-update-event

    An event triggered when the current turn in the game is updated.

    Message IDturn-update-event
    object
    • #Events
  • #20Server Error Update Eventserver-error-update-event

    An event triggered when the latest error thrown by the server hosting the chess game is updated.

    Message IDserver-error-update-event

    An error during a chess game can be one of the following:

    • GameAlreadyStartedException: a request failed because it required the game not to be started, but the game had already started.
    • GameConfiguredException: a request failed because it required the game not to be configured, but the game had already been configured.
    • GameNotReadyException: a request failed because it required the game to be ready, but the game was not.
    • GameNotRunningException: a request failed because it required the game to be running, but the game was not.
    • GameNotWaitingForPlayersException: a request failed because it required the game to be waiting for more player to join, but the game was not.
    • GameNotWaitingForPromotionException: a request failed because it required the game to be waiting for a pawn to be promoted, but the game was not.
    • GameTerminatedException: a request failed because it required the game not to be terminated, but the game had already been terminated.
    • GameWaitingForPromotionException: a request failed because it required the game not to be waiting for a pawn to be promoted, but the game was.
    • InternalServerException: an unexpected error happened during the execution of the game, probably due to the server implementation.
    • MalformedInputException: a request failed because it did not conform to the api specification of this service.
    • PlayerAlreadyExistingException: a request for joining the game failed because the team requested by the joining player had already been assigned to another player beforehand.
    object
    • #Events
  • #21Server Situation Update Eventserver-situation-update-event

    An event triggered when the situation of the server hosting the chess game is updated.

    Message IDserver-situation-update-event

    The situation of a server hosting a chess game can be one of the following:

    • NotConfigured: the server is waiting for a game configuration to be provided.
    • WaitingForPlayers: the server is waiting for enough players to join the game.
    • Ready: the server has enough players and is waiting for a user to start the game.
    • Running: the server is executing the game, listening for the players' commands.
    • Terminated: the server is terminated due to the game ending or fatal errors.
    object
    • #Events
  • #22Subscription Update Eventsubscription-update-event

    An event triggered when the subscriptions to the events generated by the game are updated.

    Message IDsubscription-update-event
    object
    • #Events

Schemas

  • object
    uid: ServerState
  • ServerSituation
    string
    uid: ServerSituation
      Allowed values:
    • "NotConfigured"
    • "WaitingForPlayers"
    • "Ready"
    • "Running"
    • "Terminated"
  • SubscriptionId
    string
    uid: SubscriptionId
  • object
    uid: ChessGameServiceException
  • object
    uid: GameState
  • object
    uid: Chessboard
  • object
    uid: Piece
  • Team
    string
    uid: Team
      Allowed values:
    • "WHITE"
    • "BLACK"
  • object
    uid: Position
  • File
    string
    uid: File
      Allowed values:
    • "A"
    • "B"
    • "C"
    • "D"
    • "E"
    • "F"
    • "G"
    • "H"
  • Rank
    string
    uid: Rank
      Allowed values:
    • "1"
    • "2"
    • "3"
    • "4"
    • "5"
    • "6"
    • "7"
    • "8"
  • object
    uid: MoveHistory
  • object
    uid: MoveHistoryEntry
  • oneOf
    uid: Move
  • object
    uid: StandardMove
  • object
    uid: CaptureMove
  • object
    uid: Castling
  • object
    uid: DoubleMove
  • object
    uid: EnPassant
  • Turn
    string
    uid: Turn
      Allowed values:
    • "WHITE"
    • "BLACK"
  • object
    uid: GameConfiguration
  • object
    uid: TimeConstraint
  • object
    uid: Duration
  • TimeUnit
    string
    uid: TimeUnit
      Allowed values:
    • "NANOSECONDS"
    • "MICROSECONDS"
    • "MILLISECONDS"
    • "SECONDS"
    • "MINUTES"
    • "HOURS"
    • "DAYS"
  • object
    uid: Player
  • GameMode
    string
    uid: GameMode
      Allowed values:
    • "PVP"
    • "PVE"
  • object
    uid: GameSituation
      Examples values:
    • {"type":"None"}
    • {"type":"Promotion","promotingPawnPosition":{"file":"A","rank":"1"}}
  • object
    uid: GameOver
  • object
    uid: TimerMap
  • PromotionChoice
    string
    uid: PromotionChoice
      Allowed values:
    • "Knight"
    • "Bishop"
    • "Rook"
    • "Queen"
  • Nullable
    null
    uid: Nullable