summaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'server.py')
-rw-r--r--server.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/server.py b/server.py
index 2c19026..c7abb20 100644
--- a/server.py
+++ b/server.py
@@ -34,13 +34,14 @@ async def handle_socket(request: web.Request):
try:
board = chess.Board()
transport, engine = await chess.engine.popen_uci('stockfish')
- await ws.send_json(dict(event="ready", player_color='white', board=board.fen()))
async def send_to_user(message: dict):
message['board'] = board.fen()
message['legalmoves'] = [m.uci() for m in board.legal_moves]
await ws.send_json(message)
+ await send_to_user(dict(event="ready", player_color='white'))
+
async for msg in ws:
msg: aiohttp.WSMessage
if msg.type == aiohttp.WSMsgType.TEXT: