99math.com network protocol 2.1.0

99math.com apps protocol documentation

Servers

  • localhost:8000httplocalCore

    Local core http server

  • localhost:9000httplocalTbl

    Local tbl websocket server

    Security:
    • HTTP API key
      • Name: jwt
      • In: query
  • core.qa.99math.comhttpsqaCore

    QA core server

  • tbl.qa.99math.comwssqaTbl

    Local development http domain for demo page

    Security:
    • HTTP API key
      • Name: jwt
      • In: query
  • core.backend.99math.comhttpsproductionCore

    Production api server

  • tbl.backend.99math.comwssproductionTbl

    Production socket.io server for live games

    Security:
    • HTTP API key
      • Name: jwt
      • In: query

Operations

  • PUB /auth/login/email

    Available only on servers:

    Accepts the following message:

    <anonymous-message-1>

    login result

    object

    Examples

  • SUB /auth/login/email

    Available only on servers:

    Accepts the following message:

    <anonymous-message-2>

    login with email and password api endpoint

    object
    uid: EmailLoginDto

    data to login with email and password

    Examples

  • PUB /auth/generate-guest-jwt

    Available only on servers:

    Accepts the following message:

    <anonymous-message-3>

    generated guest token result

    object

    Examples

  • SUB /auth/generate-guest-jwt

    Available only on servers:

    Accepts the following message:

    <anonymous-message-4>

    request to generate guest auth token

    Examples

  • PUB /game/create

    Available only on servers:

    Accepts the following message:

    <anonymous-message-5>

    live game creation result

    object

    Examples

  • SUB /game/create

    Available only on servers:

    Accepts the following message:

    <anonymous-message-6>

    creation live game

    object
    uid: CreateLiveGameRequest

    create new live game data

    Examples

  • PUB /join/{gameCode}

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts one of the following messages:

    • #0<anonymous-message-7>

      result of checking join for GET request

      object

      Examples

    • #1<anonymous-message-7>

      connection data for POST requires

      object

      Examples

  • SUB /join/{gameCode}

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts one of the following messages:

    • #0<anonymous-message-8>

      GET request to check if it's possible to join game

      Examples

    • #1<anonymous-message-8>

      POST request to join game

      object
      uid: PlayerJoinGameDto

      information about player joining game

      Examples

  • PUB /{gameCode}/info

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-9>

    game info restuctured

    object
    uid: GameInfoV1

    game info compatible with v1 frontend

    Examples

  • SUB /{gameCode}/info

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-10>

    game info request

    Examples

  • PUB /gameType/{gameCode}

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-11>

    game info restuctured

    object
    uid: GameInfoV1

    game info compatible with v1 frontend

    Examples

  • SUB /gameType/{gameCode}

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-12>

    game info request

    Examples

  • PUB /{gameCode}/leaderboard

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-13>

    game info restuctured

    array<any>

    Examples

  • SUB /{gameCode}/leaderboard

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-14>

    game info request

    Examples

  • PUB /{gameCode}/answers

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-15>

    game info restuctured

    array<any>

    Examples

  • SUB /{gameCode}/answers

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-16>

    game info request

    Examples

  • PUB /{gameCode}/challenge

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-17>

    game info restuctured

    object

    Examples

  • SUB /{gameCode}/challenge

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis or mongo game code

    Accepts the following message:

    <anonymous-message-18>

    game info request

    Examples

  • PUB live/timerSync

    live games timer sync room

    Available only on servers:

    Accepts the following message:

    timerSync

    timer sync message

    Payload
    string
    format: date-time

    date and time

    Examples

  • PUB live/{gameCode}

    live game room channel

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis (join) game code

    Accepts one of the following messages:

    • #0game-not-found

      message fires if game by websocket token data not found

      Examples

    • #1game-info

      message with current game information

      object
      uid: RedisGame

      redis game

      Examples

    • #2game-finished

      message on websocket connection, that game already finished

      Examples

    • #3playerJoinGame

      message to room about new player joined

      object
      uid: RedisPlayerInfo

      player info

      Examples

    • #4playerDisconnected

      message to room about player disconnection

      object
      uid: RedisPlayerInfo

      player info

      Examples

    • #5playerLeft

      message to room about player leaving

      Payload
      string

      clientId of left player

      Examples

    • #6hostLeftGame

      message from host about conscous game leaving or to room about host leaving

      Examples

    • #7roundPrepared

      message to room about next game round (questions only)

      object
      uid: RedisGameRound

      game round info

      Examples

    • #8startRound

      message to room about next game round start

      object

      Examples

    • #9mongoCode

      message to room about finished and saved game mongo code

      Payload
      string

      game code at mongo (permanent code)

      Examples

    • #10leaderboard

      message to room with current game leaderboard

      array<object>

      game leaderboard

      Examples

    • #11playerSelectedAvatar

      message to room about new player avatar

      object

      update information

      Examples

    • #12waitForNewQuestions

      message to room about new round questions

      object

      update information

      Examples

  • SUB live/{gameCode}

    live game room channel

    Available only on servers:

    gameCode
    required
    string
    uid: gameCode

    redis (join) game code

    Accepts one of the following messages:

    • #0handleConnection

      websocket connection to server

      Examples

    • #1handleDisconnect

      websocket disconnection from server

      Examples

    • #2leaveGame

      user leaving game message

      Examples

    • #3getGameInfo

      request game info

      Examples

    • #4updateClassCode

      updating class code for game

      object
      uid: UpdateClassCode

      update game class info

      Examples

    • #5unassignClassCode

      clearing class code for game

      Examples

    • #6fetchPlayers

      request game players

      Examples

    • #7hostPrepareRound

      message from host to prepare next round

      array<object>

      questions for the preparation round

      Examples

    • #8hostStartRound

      message from host to start next round (round should be prepared!)

      Examples

    • #9playerStats

      player stats request

      Examples

    • #10playerAnswer

      player answer

      object
      uid: AbstractGameAnswer

      player answer data

      Examples

    • #11currentRoundFinished

      message from host to finish round

      Examples

    • #12getLeaderboard

      emits leaderboard message to sender

      Payload
      any

      Examples

    • #13hostLeftGame

      message from host about conscous game leaving or to room about host leaving

      Examples

    • #14saveResultsToDB

      message to save game to mongo

      Examples

    • #15removePlayer
      Payload
      string

      clientId to kick

      Examples

    • #16selectedAvatar

      player selected avatar

      Payload
      string

      avatar code

      Examples

  • PUB live/{gameCode}-teacher

    gameCode
    required
    string
    uid: gameCode

    redis (join) game code

    Accepts the following message:

    playerAnswer

    player answer

    object
    uid: AbstractGameAnswer

    player answer data

    Examples

Messages

  • #1timerSync

    timer sync message

    Payload
    string
    format: date-time

    date and time

  • #2handleConnection

    websocket connection to server

  • #3handleDisconnect

    websocket disconnection from server

  • #4leaveGame

    user leaving game message

  • #5getGameInfo

    request game info

  • #6updateClassCode

    updating class code for game

    object
    uid: UpdateClassCode

    update game class info

  • #7unassignClassCode

    clearing class code for game

  • #8fetchPlayers

    request game players

  • #9hostPrepareRound

    message from host to prepare next round

    array<object>

    questions for the preparation round

  • #10hostStartRound

    message from host to start next round (round should be prepared!)

  • #11playerStats

    player stats request

  • #12playerAnswer

    player answer

    object
    uid: AbstractGameAnswer

    player answer data

  • #13currentRoundFinished

    message from host to finish round

  • #14hostLeftGame

    message from host about conscous game leaving or to room about host leaving

  • #15getLeaderboard

    emits leaderboard message to sender

    Payload
    any
  • #16saveResultsToDB

    message to save game to mongo

  • #17removePlayer
    Payload
    string

    clientId to kick

  • #18selectedAvatar

    player selected avatar

    Payload
    string

    avatar code

  • #19deliverQuestionsOnStudents

    message from game host with new questions for round

    object
  • #20game-not-found

    message fires if game by websocket token data not found

  • #21game-info

    message with current game information

    object
    uid: RedisGame

    redis game

  • #22game-finished

    message on websocket connection, that game already finished

  • #23playerJoinGame

    message to room about new player joined

    object
    uid: RedisPlayerInfo

    player info

  • #24playerDisconnected

    message to room about player disconnection

    object
    uid: RedisPlayerInfo

    player info

  • #25playerLeft

    message to room about player leaving

    Payload
    string

    clientId of left player

  • #26roundPrepared

    message to room about next game round (questions only)

    object
    uid: RedisGameRound

    game round info

  • #27startRound

    message to room about next game round start

    object
  • #28mongoCode

    message to room about finished and saved game mongo code

    Payload
    string

    game code at mongo (permanent code)

  • #29leaderboard

    message to room with current game leaderboard

    array<object>

    game leaderboard

  • #30playerSelectedAvatar

    message to room about new player avatar

    object

    update information

  • #31waitForNewQuestions

    message to room about new round questions

    object

    update information

Schemas

  • object
    uid: EmailLoginDto

    data to login with email and password

  • UserAuthToken
    string
    uid: UserAuthToken

    registered user auth token for http api requests packed as json web token string

  • object
    uid: UserAuthTokenPayload

    registered user payload

  • GuestToken
    string
    uid: GuestToken

    guest auth token for http api requests packed as json web token string

  • object
    uid: GuestTokenPayload

    guest auth token payload

  • GameToken
    string
    uid: GameToken

    game token for for websocket connection packed as json web token string

  • object
    uid: GameTokenPayload

    game token payload

  • object
    uid: PlayerJoinGameDto

    information about player joining game

  • object
    uid: CvcChallenge

    cvc challenge info

  • object
    uid: AbstractNumberGenerator

    game number generator info

  • object
    uid: AbstractGameType

    game type info

  • object
    uid: AbstractGameRoundsInfo

    game rounds info

  • object
    uid: AbstractRoundQuestion

    game round question basic

  • object
    uid: AbstractQuestionBody

    game question extended

  • object
    uid: AbstractGameAnswer

    player answer data

  • object
    uid: RedisPlayerInfo

    player info

  • object
    uid: RedisGameRound

    game round info

  • object
    uid: RedisGameStats

    base game info

  • object
    uid: RedisPlayerRoundStats

    player round stats

  • object
    uid: RedisPlayerStats

    player game stats

  • object
    uid: RedisTeacherData

    game teacher's additional info

  • object
    uid: RedisGame

    redis game

  • object
    uid: UpdateClassCode

    update game class info

  • object
    uid: CreateLiveGameRequest

    create new live game data

  • object
    uid: GameInfoV1

    game info compatible with v1 frontend

  • object
    uid: LeaderboardRecord

    leaderboard record