PokerProtocol
work in progress
All communication will be encoded in JSON for the time being. This is both simple to encode/decode in python using simplejson package, as well as in javascript. It's also a lot more lightweight than XML and since complex data types and structures aren't needed.
joining a game
{ "method" : "connect" "user_id" : "mikelikespie" "client_id" : "asdfabcd" "table_name" : "test_table" }
server responses
on error
{ "stat" : "fail" "code" : 325 "message" : "Ate my waffle" }
successful state return
Here's an example what an error would look like. I still need to define the errors and such.
{ "action": "Player added", "stat" : "ok", "msg_id" : "abcd3589sdfa", "type" : "game_state", "you" : { "user_id" : "mikelikespie", "id" : "1Sfg", "required_action" : True, "cards" : [ ["2", "diamonds"], ["7", "hearts"] ], "possible_actions" : { "check":null, "fold":null, "raise":5.0, "call":2.5, "bet":2.5 } }, "table_info" : { "game_in_progress" : True, "name" : "Mike's poker room1351251" "button_on" : 1, "blinds" : [1.0,2.0] "players" : { "1Sfg" : { "owner" : "mikelikespie", "status" : "in_hand", "money" : 350.35, "seat" : 0 }, "che35ez" : { "owner" : "cheezbuger", "status" : "folded", "money" : 355, "seat" : 1 }, "lolrus2" : { "owner" : "lolrus", "status" : "sitting_out", "money" : 2141.00, "seat" : 2 } } } "game_state" : { "phase" : "river", "action_on" : 0, "pot_before_phase" : 12551.0, "community_cards" : [["2", "hearts"],["7", "clubs"],["9", "spades"],["2", "clubs"],["A", "diamonds"]], "player_actions" : { "lolrus2" : [[ "check", null ], [ "call", 50.0 ], [ "raise", 50.0 ]], "che35ez" : [[ "check", null ], [ "fold", null ]], "1Sfg" : [[ "bet", 50.0 ], [ "call", 50.0 ]] } } }
