From 16c1fd9d8043ba1970080bfd19929d304b522eec Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 26 May 2020 22:34:48 -0700 Subject: [PATCH] Add an initial protocol description for the tictactoe game So far this just supports sending and receiving a move, (but what else does Tic Tac Toe need, right?). --- tictactoe.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tictactoe.txt diff --git a/tictactoe.txt b/tictactoe.txt new file mode 100644 index 0000000..62046a6 --- /dev/null +++ b/tictactoe.txt @@ -0,0 +1,44 @@ +Tic Tac Toe Game Protocol +========================= +Note: All square numbers in the protol below are as follows: + + 0|1|2 + -+-+- + 3|4|5 + -+-+- + 6|7|8 + +For a specific game the following API endpoints are defined. +(Note: Only the trailing portion of the API URI is provided here. + The preceding portions of the path must be determined externally.) + +/events + + This is a server-sent events stream that allows the server to push + game-related events to clients. When a client connects to this API + endpoint the server will return a header that includes: + + Content-type: text/event-stream + Connection: keep-alive + Cache-Control: no-cache + + and will keep the connection open to return events. + + The following event types will be returned by the server: + + TYPE: move + + WHEN: When a client (maybe yourself) issues a legal move + + EXAMPLE: + + event: move + data: 4 + +/move + + Method: POST + + Behavior: Adds a new move to the game + + Example data: { "square": 4 } -- 2.43.0