Update README.md
This commit is contained in:
parent
ef5696f61d
commit
57f2686c67
58
README.md
58
README.md
@ -5,27 +5,31 @@ a python server backend for ultimate tic-tac-toe.
|
|||||||
communication with the web client is done by a (far from any standard and almost random) json protocol:
|
communication with the web client is done by a (far from any standard and almost random) json protocol:
|
||||||
|
|
||||||
|
|
||||||
|
## setup server
|
||||||
|
|
||||||
## new version:
|
setup the database connection settings in `settings.py`. If files for a certificate are given, the websocket connection will be use the secured `wss://` websocket protocol instead of `ws://` (which is necessary if the client is accessed by `https://`). To create the necessary tables, the script `./create_database.py` can be used
|
||||||
|
|
||||||
|
|
||||||
|
## communication protocol with client
|
||||||
|
|
||||||
**json match state:**
|
**json match state:**
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
complete_field: '[[...],[...],...]',
|
'complete_field': '[[...],[...],...]',
|
||||||
global_field: '[[...],[...],...]',
|
'global_field': '[[...],[...],...]',
|
||||||
last_move: {
|
'last_move': {
|
||||||
"sub_x": "...",
|
"sub_x": "...",
|
||||||
"sub_y": "...",
|
"sub_y": "...",
|
||||||
"x": "...",
|
"x": "...",
|
||||||
"y": "..."
|
"y": "..."
|
||||||
}
|
}
|
||||||
game_over: <true | false>,
|
'game_over': <true | false>,
|
||||||
is_draw: <true | false>,
|
'is_draw': <true | false>,
|
||||||
player_won: <null | <player_name>>,
|
'player_won': <null | <player_name>>,
|
||||||
current_player: <null | <player_name>>,
|
'current_player': <null | <player_name>>,
|
||||||
player_a: "...",
|
'player_a': "...",
|
||||||
player_b: "..."
|
'player_b': "..."
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -33,6 +37,8 @@ communication with the web client is done by a (far from any standard and almost
|
|||||||
|
|
||||||
**match**:
|
**match**:
|
||||||
|
|
||||||
|
server sends this to every user which is participating in a match if it's updated
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "match_update",
|
"type": "match_update",
|
||||||
@ -45,11 +51,12 @@ communication with the web client is done by a (far from any standard and almost
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**new temp session**
|
**new temp session**
|
||||||
|
|
||||||
|
NOT IMPLEMENTED YET (and maybe never will be)
|
||||||
|
|
||||||
|
give the possibility to temporary login without a password
|
||||||
|
|
||||||
client
|
client
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -76,6 +83,8 @@ server response:
|
|||||||
|
|
||||||
**connect by session id**
|
**connect by session id**
|
||||||
|
|
||||||
|
reconnect with the session id from the last session
|
||||||
|
|
||||||
client
|
client
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -101,6 +110,11 @@ server response:
|
|||||||
|
|
||||||
**login or register**:
|
**login or register**:
|
||||||
|
|
||||||
|
login with username and password. If the username does not exist yet, a new account
|
||||||
|
is created automatically. After a successful login the server sends an elo update, friends update and match updates for each open match,.
|
||||||
|
|
||||||
|
client:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "login",
|
"type": "login",
|
||||||
@ -111,7 +125,7 @@ server response:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
response:
|
server response:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -125,12 +139,12 @@ response:
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**match_request**:
|
**match_request**:
|
||||||
|
|
||||||
client (or server for sending invites)
|
will be send by clients. If `player` is `null` the player will be matched with the next (or previous)
|
||||||
|
player which sent a request without a player name
|
||||||
|
|
||||||
|
client:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -155,6 +169,8 @@ server_response:
|
|||||||
|
|
||||||
**match_move**:
|
**match_move**:
|
||||||
|
|
||||||
|
sending moves to the server. The server will answer with a match update.
|
||||||
|
|
||||||
client
|
client
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -174,7 +190,7 @@ client
|
|||||||
|
|
||||||
**match update**
|
**match update**
|
||||||
|
|
||||||
(also send on match start and send for all matches after login)
|
(is also sent on match start and send for all matches after login)
|
||||||
|
|
||||||
server:
|
server:
|
||||||
|
|
||||||
@ -253,6 +269,8 @@ response:
|
|||||||
|
|
||||||
**friend update**:
|
**friend update**:
|
||||||
|
|
||||||
|
is sent by server after a login or reconnect
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "friends_update",
|
"type": "friends_update",
|
||||||
@ -267,6 +285,8 @@ response:
|
|||||||
|
|
||||||
**elo rank update**:
|
**elo rank update**:
|
||||||
|
|
||||||
|
is sent by server after login, reconnect or a finished match
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "elo_update",
|
"type": "elo_update",
|
||||||
|
Loading…
Reference in New Issue
Block a user