]> git.cworth.org Git - empires-api/commitdiff
tictactoe: Document a game-state event
authorCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 14:19:45 +0000 (07:19 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 14:19:45 +0000 (07:19 -0700)
This gives a snapshot of the current state as well as the history of
all moves up until now. This event will be served to a client when
joining a game in progress.

tictactoe.txt

index 62046a6e23822d5d72f907c95adfb9f2c6c39826..b79f72c6310905914ef31ae64c38426e3ac392a4 100644 (file)
@@ -26,6 +26,15 @@ For a specific game the following API endpoints are defined.
 
     The following event types will be returned by the server:
 
+        TYPE: game-state
+
+        WHEN: When a client first connections
+
+        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