]> git.cworth.org Git - empires-api/blob - tictactoe.txt
empires: Use "phase" instead of "state" for the different phases of the game
[empires-api] / tictactoe.txt
1 Tic Tac Toe Game Protocol
2 =========================
3 Note: All square numbers in the protol below are as follows:
4
5         0|1|2
6         -+-+-
7         3|4|5
8         -+-+-
9         6|7|8
10
11 For a specific game the following API endpoints are defined.
12 (Note: Only the trailing portion of the API URI is provided here.
13  The preceding portions of the path must be determined externally.)
14
15 /events
16
17     This is a server-sent events stream that allows the server to push
18     game-related events to clients. When a client connects to this API
19     endpoint the server will return a header that includes:
20
21         Content-type: text/event-stream
22         Connection: keep-alive
23         Cache-Control: no-cache
24
25     and will keep the connection open to return events.
26
27     The following event types will be returned by the server:
28
29         TYPE: move
30
31         WHEN: When a client (maybe yourself) issues a legal move
32
33         EXAMPLE:
34
35                 event: move
36                 data: 4
37
38 /move
39
40     Method: POST
41
42     Behavior: Adds a new move to the game
43
44     Example data: { "square": 4 }