# ultimate_tictactoe_server a python server backend for ultimate tic-tac-toe. communication with the web client is done by a (far from any standard and almost random) json protocol: ## new version: **json match state:** ```json { complete_field: '[[...],[...],...]', global_field: '[[...],[...],...]', last_move: { "sub_x": "...", "sub_y": "...", "x": "...", "y": "..." } game_over: , is_draw: , player_won: >, current_player: >, player_a: "...", player_b: "..." } ``` **match**: ```json { "type": "match_update", "data": { "id": "...", "match_state": > } } ``` **new temp session** client ```json { "type": "temp_session", "data": { "name": "" } } ``` server response: ```json { "type": "login_response", "data": { "success": , "id": "", "msg": "..." } } ``` **connect by session id** client ```json { "type": "reconnect", "data": { "id": "", } } ``` server response: ```json { "type": "reconnect_response", "data": { "success": , "msg": "..." } } ``` **login or register**: ```json { "type": "login", "data": { "name": "", "pw": "" } } ``` response: ```json { "type": "login_response", "data": { "success": , "id": "", "msg": "..." } } ``` **match_request**: client (or server for sending invites) ```json { "type": "match_request", "data": { "player": > } } ``` server_response: ```json { "type": "match_request_response", "data": { "success": "msg": "..." } } ``` **match_move**: client ```json { "type": "move", "data": { "id": "match_id", "sub_x": "...", "sub_y": "...", "x": "...", "y": "..." } } ``` **match update** (also send on match start and send for all matches after login) server: ```json { "type": "match_update", "data": { "id": "", "match_state": "" } } ``` **match close** client: ```json { "type": "end_match", "data": { "id": "" } } ``` **friend request**: ```json { "type": "friend_request", "data" : { "user": "" } } ``` response: ```json { "type": "friend_request_response", "data": { "success": "msg": "..." } } ``` **unfriend**: ```json { "type": "unfriend_request", "data" : { "user": "" } } ``` response: ```json { "type": "unfriend_request_response", "data": { "success": "msg": "..." } } ``` **friend update**: ```json { "type": "friends_update", "data": { "friends": "", "elos": "" } } ``` **elo rank update**: ```json { "type": "elo_update", "data": { "elo": , "rank": , "top_names": , "top_elos": } } ```