Overview

Connection Information

The websocket server listens at wss://praetorpoker.com/gameserver

HMAC Authentication

The game server uses HMACs (hash-based message authentication code) to authenticate messages sent by players.
A brief explanation: HMACs are created by concatenating a key string and a message string and then running the concatenated string through a hash function. The game server uses the SHA-256 hash function.
For all messages sent by a bot to the server, The HMAC key string will be the <secret string> chosen by the user during the initial registration process. The HMAC message string depends on what kind of message the bot is sending to the game server:

message_typeHMAC message component
check_in<match_id> (as a string)
input_action<action>
For more information on HMAC see the HMAC Wikipedia page.
The Python starter bot has a simple HMAC implementation method that can be copied.

Card Messages

Messages that contain card values (hole cards, flop, turn, river) are designated as "card string" type and use the following scheme:
Each card is represented by a 2-character string. The first character is the card's rank and the secnond character is the card's suit. The rank character is either a number or a capital letter. The suit character is a lowercase letter. If multiple cards are included in a single card string, the cards are separated by an underscore character.
RankSingle character representation
AceA
Two2
Three3
Four4
Five5
Six6
Seven7
Eight8
Nine9
TenT
JackJ
KingQ
QueenK
SuitSingle character representation
Heartsh
Clubsc
Diamondsd
Spadess
Card string examples:
The Ace of Hearts is represented as "Ah"
Hole cards containing the Three of Spades and the Ten of Clubs is represented as "3s_Tc"


Messages sent from player to game server


Check-in

This is the first message sent by a bot once it connects to the websocket server.
FieldTypeDescription
message_typestring (constant)Always equals "check_in" for check-in messages
player_idint
match_idint
signaturestringHMAC signature created according to the HMAC signature protocol

Input action

This message is sent each time a bot intends to make an action. In case of an invalid input action, the game engine will attempt to reassign the action according to the game rules. If the action cannot be reassigned it will be designated as a fold, so it is recommended to implement some action validation in the bot.
FieldTypeDescription
message_typestring (constant)Always equals "input_action" for input_action messages
player_idint
match_idint
actionstringAction that the player is taking. See Action table for details
signaturestringHMAC signature created according to the HMAC signature protocol

Messages sent from game server to player



Check-in confirmation

Sent privately to a participant to indicate successful check-in.
FieldTypeDescription
message_typestring (constant)Always equals "checkin_confirmation" for checkin confirmation messages
player_idint
match_idint

Check-in Error

Sent privately to a participant to indicate an unsuccessful check-in attempt. Most commonly occurs if the match_id is incorrect in the bot's initial checkin message or if the bot continues to send check-in messages after it has already successfully checked in.
FieldTypeDescription
message_typestring (constant)Always equals "checkin_error" for checkin error messages
player_idint
match_idint
error_typestringCause of the unsuccessful checkin attempt

Initial match state

Broadcast to all participants at the beginning of a match after everyone has checked in.
FieldTypeDescription
message_typestring (constant)Always equals "initial_game_state" for initial game state messages
starting_stackintAmount of chips each player starts the match with
blind_amounts
---- smallintSmall blind size
---- bigintBig blind size
player_names
---- player_1stringPlayer 1 public username
---- player_2stringPlayer 2 public username

New hand

Sent privately to each participant at the beginning of each hand. The message is identical across participants except for the hole_cards field.
FieldTypeDescription
message_typestring (constant)Always equals "new_hand" for new hand mesages
blinds
---- bigstringPlayer posting big blind
---- smallstringPlayer posting small blind
current_stagestring (constant)Current hand stage. Value is always "preflop" in the new_hand message
hole_cardsstringString representation of hole cards

Next to act

Sent privately to the participant who is next to act.
FieldTypeDescription
message_typestring (constant)Always equals "next_to_act" for next-to-act messages
player_idint
match_idint
to_callintAmount required to call existing bet
current_round_betintSize of player's existing bet for the current round
available_actionsstring arrayList of valid actions for this turn

Effective action

Broadcast to all participants after a player makes an action.
FieldTypeDescription
message_typestring (constant)Always equals "effective_action" for effective action messages
player_idint
match_idint
actionstringThe action taken by the player. This will be the same as the input action except in cases of an invalid input action
pot_sizeintPot size after accounting for this action

New stage

Broadcast to all participants when a hand advances to a new stage.
FieldTypeDescription
message_typestring (constant)Always equals "stage" for new stage messages
current_stagestringCurrent hand stage. Possible values are {"preflop", "flop", "turn", "river"}
board_updatecard stringNew cards added to the board

End hand

Broadcast to all players at the end of a hand. Note that some of the contents of this message may change depending on the hand outcome.
FieldTypeDescription
message_typestring (constant)Always equals "end_hand" for end hand messages
winnerstringPublic username of player who won the hand. In case of a split pot, the Type will instead be an array of strings containing the public usernames of all winners.
stack_size
---- <player_1 username>intPlayer 1's stack size at the end of the hand
---- <player_2 username>intPlayer 2's stack size at the end of the hand
hole_cardsThis is an optional field. hole_cards will be included if and only if the hand reached showdown
---- <player_1 username>stringPlayer 1's hole cards
---- <player_2 username>stringPlayer 2's hole cards

End match

Broadcast to all players at the end of a match.
FieldTypeDescription
message_typestring (constant)Always equals "end_match" for end match messages
winnerstringusername of player who won the match