Browse Source

feat(chess): improve resources README

- add steps to interact with websocket from terminal when testing
server locally
- fix header
pull/2092/head
nprimo 1 year ago committed by Niccolò Primo
parent
commit
d208e9ce8d
  1. 12
      subjects/mobile-dev/chess/resources/README.md

12
subjects/mobile-dev/chess/resources/README.md

@ -22,6 +22,7 @@ Requirements:
- `golang 1.19` - `golang 1.19`
- `PORT` environment exported - `PORT` environment exported
- a tool to interact with websockets in your terminal, such as [`websocat`](https://github.com/vi/websocat)
Export `PORT` environmental variable. The port can be any port you would like. Export `PORT` environmental variable. The port can be any port you would like.
@ -59,11 +60,20 @@ Run the project with `PORT` env set:
docker run -d -e PORT=8080 -p 8080:8080 chess docker run -d -e PORT=8080 -p 8080:8080 chess
``` ```
## Interacting with websocket server to play chess > The output of this command is already a valid UUID
### Interacting with websocket server to play chess
To play chess, players need to be matched with other player. To play chess, players need to be matched with other player.
Firstly, connect using websocket to the endpoint `ws://localhost:8080/rooms`. Firstly, connect using websocket to the endpoint `ws://localhost:8080/rooms`.
You can use `websocat` or any other CLI tool you like to do so if you are running the server locally.
```bash
websocat ws://localhost:8080/rooms
```
After successful connection, client (e.g. player) needs to wait for response from the server. After successful connection, client (e.g. player) needs to wait for response from the server.
The response will be of the following type: The response will be of the following type:

Loading…
Cancel
Save