2022-06-04 15:52:26 +03:00
|
|
|
# chess_rpg_backend
|
2022-07-02 14:18:19 +03:00
|
|
|
DEV branch for backend for chess rpg game
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
##### dev server for up to date endpoints(web socket not provided)
|
|
|
|
|
|
|
|
- https://dev.akarpov.ru
|
|
|
|
|
|
|
|
<hr>
|
2022-06-21 11:37:18 +03:00
|
|
|
|
|
|
|
### installation
|
|
|
|
```shell
|
|
|
|
$ python3 manage.py makemigrations & python3 manage.py migrate
|
|
|
|
$ docker run -p 6379:6379 -d redis:5
|
|
|
|
```
|
|
|
|
|
|
|
|
### run
|
|
|
|
```shell
|
2022-07-02 14:57:58 +03:00
|
|
|
$ daphne -b 0.0.0.0 -p 8000 chess_backend.asgi:application
|
2022-07-01 15:12:32 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
### Описание команд сокетов
|
2022-07-01 15:13:28 +03:00
|
|
|
```python
|
2022-07-01 15:12:32 +03:00
|
|
|
# подключиние к очереди(ws://room/)
|
|
|
|
{
|
|
|
|
"type": "connect",
|
|
|
|
"deck_id": int
|
|
|
|
}
|
|
|
|
|
|
|
|
# коннект к комнате (сообщение от сервера)
|
|
|
|
{
|
|
|
|
"type": "INFO",
|
|
|
|
"opponent_score": int,
|
|
|
|
"coordinates" : [(x: int, y: int, type: str, model_url: url, your: bool), ...],
|
|
|
|
"opponent_online": true,
|
|
|
|
"first": bool
|
|
|
|
}
|
|
|
|
|
|
|
|
# состояние оппонента в комнате(сообщение от сервера)
|
|
|
|
{
|
|
|
|
"type": "INFO",
|
|
|
|
"message": "opponent is online" / "opponent is offline"
|
|
|
|
}
|
|
|
|
```
|