summaryrefslogtreecommitdiff
path: root/swiftstory/interface
diff options
context:
space:
mode:
Diffstat (limited to 'swiftstory/interface')
-rw-r--r--swiftstory/interface/ws.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/swiftstory/interface/ws.py b/swiftstory/interface/ws.py
index a86c730..082ed1a 100644
--- a/swiftstory/interface/ws.py
+++ b/swiftstory/interface/ws.py
@@ -1,3 +1,6 @@
+""" Module that defines the interface (using WebSockets) between the GUI and
+the game itself. """
+
import contextlib
import json
import logging
@@ -18,6 +21,7 @@ class WebsocketsInterface:
self.game_manager = game_manager
async def connection_handler(self, websocket: WebSocketServerProtocol, path: str) -> None:
+ """ Coroutine that handles one websocket connection. """
client = Client(websocket, self.game_manager)
with contextlib.suppress(websockets.exceptions.ConnectionClosed):
@@ -27,6 +31,7 @@ class WebsocketsInterface:
client.disconnect()
def message_received_handler(self, client: Client, message: Union[bytes, str]) -> str:
+ """ Handle a message and return an answer. """
def join_game() -> str:
try:
game_name = json_msg['game_name']