Update readme

This commit is contained in:
Eden Kirin
2023-03-25 16:30:17 +01:00
parent 894d2b0707
commit f8506a66ba
2 changed files with 21 additions and 13 deletions

View File

@ -53,7 +53,7 @@ Edit `settings.py` and customize application.
make run make run
``` ```
By default, JFK runs on port **8010**. To run on other port, start `uvicorn` directly: By default, FairHopper runs on port **8010**. To run FairHopper on different port, start `uvicorn` directly:
```sh ```sh
poetry run uvicorn main:app --host 0.0.0.0 --port 8010 --workers=1 poetry run uvicorn main:app --host 0.0.0.0 --port 8010 --workers=1
``` ```
@ -63,6 +63,14 @@ To activate virtual environment:
poetry shell poetry shell
``` ```
### Starting WebSockets Server
```sh
make run-ws
```
WebSockets server runs on port **8011**. To run WS Server on different port, edit `settings.py` configuration.
## System overview ## System overview
@ -74,31 +82,31 @@ actor "Player 2" as P2
actor "Player 3" as P3 actor "Player 3" as P3
package Masterpiece { package Masterpiece {
usecase JFK as "JFK Game Server" usecase Game as "FairHopper Game Server"
usecase WS as "WS Server" usecase WS as "WS Server"
usecase Vis as "Visualisation\nService" usecase Vis as "Visualisation\nService"
} }
P1 -left-> JFK: REST API P1 -left-> Game: REST API
P2 -left-> JFK: REST API P2 -left-> Game: REST API
P3 -left-> JFK: REST API P3 -left-> Game: REST API
JFK --> WS: WebSockets Game --> WS: WebSockets
WS --> Vis: WebSockets WS --> Vis: WebSockets
``` ```
### WebSockets ### WebSockets
```plantuml ```plantuml
participant JFK as "JFK Game Server" participant Game as "FairHopper Game Server"
participant WS as "WS Server" participant WS as "WS Server"
participant Client1 as "Visualisation\nClient 1" participant Client1 as "Visualisation\nClient 1"
participant Client2 as "Visualisation\nClient 2" participant Client2 as "Visualisation\nClient 2"
JFK ->o WS: Server Connect Game ->o WS: Server Connect
activate WS #coral activate WS #coral
WS -> JFK: Get game state WS -> Game: Get game state
activate JFK #yellow activate Game #yellow
JFK -> WS: Game state Game -> WS: Game state
deactivate deactivate
deactivate deactivate
@ -113,7 +121,7 @@ WS --> Vis: WebSockets
deactivate deactivate
loop #lightyellow On game state change loop #lightyellow On game state change
JFK ->o WS: Game state Game ->o WS: Game state
activate WS #coral activate WS #coral
WS o-> Client1: Game state WS o-> Client1: Game state
WS o-> Client2: Game state WS o-> Client2: Game state

View File

@ -10,7 +10,7 @@ logging.basicConfig(
level=settings.log_level, level=settings.log_level,
format="%(asctime)s %(levelname)s - %(message)s", format="%(asctime)s %(levelname)s - %(message)s",
) )
logging.info("JFK Game server started.") logging.info("FairHopper Game Server started.")
app = FastAPI() app = FastAPI()
app.include_router(router, tags=["Game API"]) app.include_router(router, tags=["Game API"])