]> git.cworth.org Git - empires-api/blobdiff - tictactoe.txt
Add a new game-info event
[empires-api] / tictactoe.txt
index 62046a6e23822d5d72f907c95adfb9f2c6c39826..361caf79cd59e27cd4cfead92c83f83bb14b628b 100644 (file)
@@ -26,6 +26,28 @@ For a specific game the following API endpoints are defined.
 
     The following event types will be returned by the server:
 
+       TYPE: game-info
+
+       WHEN: When a client first connects
+
+       WHAT: Static information about the game (will not change)
+
+        EXAMPLE:
+
+               event: game-info
+                data: {"id":"WXYZ","url":"https://lmno.games/WXYZ"}
+
+       TYPE: game-state
+
+       WHEN: When a client first connects
+
+       WHAT: Snapshot of the current dynamic game state
+
+       EXAMPLE:
+
+               event: game-state
+               data: {"moves":[0,8],"board":["X","","","","","","","","O"],"next_player":"X"}
+
        TYPE: move
 
        WHEN: When a client (maybe yourself) issues a legal move
@@ -41,4 +63,4 @@ For a specific game the following API endpoints are defined.
 
     Behavior: Adds a new move to the game
 
-    Example data: { "square": 4 }
+    Example data: { "move": 1 }