diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-12-29 19:21:45 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-12-29 20:06:14 +0100 |
commit | 741f8234edde84dccefcbf5dc0ba3b70c0e016e2 (patch) | |
tree | c6207bfd9c20eeac59bea2ffef5d4fad70108c29 /swiftstory/interface/ws.py | |
parent | f5edd5035d06adc7b6bceb1f521b4911706cde0b (diff) |
Add docstrings to all modules
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/interface/ws.py')
-rw-r--r-- | swiftstory/interface/ws.py | 5 |
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'] |