Crash

This document outlines the socket.io events used for the Crash game.

All events are prefixed crash: unless they are global game events.

Game States

The game cycles through three states:

  1. waiting: The betting period (6 seconds). Users can place or update bets.

  2. in-game: The multiplier starts at 1.00x and increases until it crashes.

  3. after: The period immediately after a crash (3 seconds) before the next round.


Client to Server Events (Emitted by Frontend)

crash:bet

Places a bet for the upcoming round.

  • Payload:

    {
      "betAmount": 100.50,
      "autoCashout": 2.50
    }
  • Notes: autoCashout is optional (0 or undefined for manual cashout).

crash:cashout

Triggers a manual cashout during the in-game state.

  • Payload: None

crash:status

Requests the current game state.

  • Payload: None

crash:history

Requests the last 20 crash multipliers.

  • Payload: None

crash:bet-count

Requests the number of players in the current round.

  • Payload: None


Server to Client Events (Listened by Frontend)

crash:loop

Continuous updates for the game timer or multiplier.

  • Payload (Waiting/After):

  • Payload (In-Game):

  • Payload (Crash):

crash:bet

Response to a bet attempt.

  • Payload:

    OR

crash:cashout

Response to a manual cashout attempt.

  • Payload:

crash:cashouts

Broadcasted when any user cashes out.

  • Payload:

crash:status

Current game status.

  • Payload:

crash:history

Last 20 multipliers.

  • Payload:

crash:bet-count

Total players in the round.

  • Payload:

crash:bet-amount (User-specific)

Sent to the betting user to confirm their total wager.

  • Payload:

balance-change (User-specific)

Sent when a user's balance changes due to a bet or win.

  • Payload:

Last updated