bet

GUI Message Formats Documentation

This document provides a comprehensive reference for all JSON message formats used in communication between the Pangea-Bet backend and the GUI frontend via WebSocket.

Table of Contents

  1. Connection Details
  2. Common Wallet Messages
  3. Dealer Node Messages
  4. Player Node Messages
  5. Cashier Node Messages
  6. Message Flow Diagrams

Connection Details

WebSocket Connection

Node Types


Common Wallet Messages

These messages are supported by all node types (Dealer, Player, Cashier).

Get Balance Info

Request:

{
  "method": "get_bal_info"
}

Response:

{
  "method": "bal_info",
  "chips_bal": 123.45678900
}

Fields:


Get Address Info

Request:

{
  "method": "get_addr_info"
}

Response:

{
  "method": "addr_info",
  "chips_addr": "Rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Fields:


Withdraw Request

Request:

{
  "method": "withdrawRequest"
}

Response:

{
  "method": "withdrawResponse",
  "balance": 123.45678900,
  "tx_fee": 0.00010000,
  "addrs": [
    {
      "address": "Rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "label": "default"
    }
  ]
}

Fields:


Withdraw

Request:

{
  "method": "withdraw",
  "amount": 10.5,
  "addr": "Rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Response:

{
  "method": "withdrawInfo",
  "tx": {
    "txid": "abc123...",
    "hex": "01000000...",
    "fee": 0.00010000
  }
}

Fields:

Note: Withdrawals are restricted to addresses owned by the backend wallet for security.


Dealer Node Messages

Game Info

Request:

{
  "method": "game"
}

Response:

{
  "method": "game",
  "game": {
    "tocall": 0,
    "seats": 2,
    "pot": [0],
    "gametype": "NL Hold'em<br>Blinds: 3/6"
  }
}

Fields:


Seats Info

Request:

{
  "method": "seats"
}

Response:

{
  "method": "seats",
  "seats": [
    {
      "playerid": 0,
      "name": "Player1",
      "chips": 1000,
      "status": "active"
    },
    {
      "playerid": 1,
      "name": "Player2",
      "chips": 1000,
      "status": "active"
    }
  ]
}

Fields:


Chat

Request:

{
  "method": "chat",
  "message": "Hello everyone!"
}

Response: (Echoed back or broadcast to all players)

Fields:


Reset

Request:

{
  "method": "reset"
}

Response: (No specific response, game state is reset)

Note: Resets all dealer control variables and game state.


Player Node Messages

Backend Status

Request:

{
  "method": "backend_status"
}

Response:

{
  "method": "backend_status",
  "backend_status": 1
}

Fields:


Betting

Request:

{
  "method": "betting",
  "round": 0,
  "action": 4,
  "amount": 10.5
}

Response: (Game state updates sent via other messages)

Fields:


Player Join

Request:

{
  "method": "player_join",
  "table_id": "abc123...",
  "player_id": "player_verus_id@"
}

Response:

{
  "method": "join_info",
  "playerid": 0,
  "table_id": "abc123...",
  "status": "joined"
}

Fields:


Reset

Request:

{
  "method": "reset"
}

Response: (Game state reset)


Sit Out

Request:

{
  "method": "sitout",
  "value": 1
}

Response: (No specific response)

Fields:


Wallet Info

Request:

{
  "method": "walletInfo"
}

Response:

{
  "method": "walletInfo",
  "addr": "Rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "balance": 123.45678900,
  "backend_status": 1,
  "max_players": 9,
  "table_min_stake": 0.5,
  "small_blind": 0.01,
  "big_blind": 0.02,
  "table_id": "abc123...",
  "tx_fee": 0.00010000
}

Fields:


Warning

Sent from backend (unsolicited):

{
  "method": "warning",
  "warning_num": 0
}

Fields:


Game State Messages (Sent from Backend)

Init Deck

{
  "method": "init_d",
  "deckid": "abc123...",
  "cardprods": [...],
  "dcvblindcards": [...]
}

Init Player

{
  "method": "init",
  "playerid": 0,
  "deckid": "abc123...",
  "cardprods": [...]
}

Join Response

{
  "method": "join_res",
  "playerid": 0,
  "status": "joined"
}

Turn Info

{
  "method": "turn",
  "playerid": 0,
  "cardid": 5,
  "card_type": 1
}

Game Info

{
  "method": "game_info",
  "round": 0,
  "pot": 100,
  "tocall": 10
}

Final Info

{
  "method": "finalInfo",
  "winners": [0, 1],
  "payouts": [50, 50]
}

Cashier Node Messages

Cashier nodes support only the common wallet messages listed above:

Cashier nodes do not have game-specific functionality in the GUI.


Message Flow Diagrams

Dealer Initialization Flow

GUI → Backend: {"method": "game"}
Backend → GUI: {"method": "game", "game": {...}}

GUI → Backend: {"method": "seats"}
Backend → GUI: {"method": "seats", "seats": [...]}

Player Join Flow

GUI → Backend: {"method": "player_join", ...}
Backend → GUI: {"method": "join_info", ...}

GUI → Backend: {"method": "walletInfo"}
Backend → GUI: {"method": "walletInfo", ...}

Betting Flow

GUI → Backend: {"method": "betting", "round": 0, "action": 4, "amount": 10}
Backend → GUI: {"method": "game_info", "round": 0, "pot": 100, ...}
Backend → GUI: {"method": "turn", "playerid": 0, ...}

Wallet Operations Flow

GUI → Backend: {"method": "get_bal_info"}
Backend → GUI: {"method": "bal_info", "chips_bal": 123.45}

GUI → Backend: {"method": "withdrawRequest"}
Backend → GUI: {"method": "withdrawResponse", "balance": 123.45, "addrs": [...]}

GUI → Backend: {"method": "withdraw", "amount": 10, "addr": "Rxxx..."}
Backend → GUI: {"method": "withdrawInfo", "tx": {...}}

Error Handling

Invalid Method

If an unknown method is sent, the backend will log a warning but may not send an error response. The GUI should handle timeouts appropriately.

Invalid Parameters

If required parameters are missing or invalid:

Connection Status


Implementation Notes

WebSocket Write Functions

Common Wallet Handler

All wallet operations use common functions from payment.c:

Node-Specific Handlers


Version Information


Additional Resources