Update api

This commit is contained in:
Loic Guegan 2019-05-12 11:16:16 +02:00
parent 4ce40ee01d
commit 8cba94e081
4 changed files with 17 additions and 21 deletions

View file

@ -4,14 +4,10 @@
#+LATEX_HEADER: \usepackage{fullpage}
* General Description
- All transmissions will be based on TCP since:
- Packet length are not fixed (large variance depending on the snake size and food)
- Packet ordering is important (inverted request can compromise gameplay)
- All TCP streams from *client to server* will:
- Contain _plain json data_
- Be terminated by an "#EOF" line (in order for the server to detect the end of the client request)
- All TCP stream from *server to client* will contains _plain json data_ (connection will be closed by the server
so, there is no need of "#EOF").
- All transmissions will be based on UDP since latency is important
- All UDP datagrams between *client and server* will contain _plain json data_
- All data should be sent in *one* datagram
- All utf-8 characters in UDP datagram are in lower case
* Communications
** Initialisation
1. Client sent:
@ -19,7 +15,6 @@
{
"type": "new-game"
}
#EOF
#+END_SRC
2. Server can reply:
#+BEGIN_SRC json
@ -40,7 +35,6 @@
"game-id": 1,
"direction": "left",
}
#EOF
#+END_SRC
2. Then, server can reply:
#+BEGIN_SRC json
@ -60,7 +54,6 @@
"game-id": 1,
"direction": null
}
#EOF
#+END_SRC
2. Server can reply:
#+BEGIN_SRC json

Binary file not shown.