From 40d54a78a6cfb510bfca30d9ab5cdb01f7956548 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 21 May 2020 23:24:47 +0200 Subject: Don't pass both the client and the socket Signed-off-by: Olivier Gayot --- swiftstory/SwiftStory.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/swiftstory/SwiftStory.py b/swiftstory/SwiftStory.py index 256c2be..b252040 100644 --- a/swiftstory/SwiftStory.py +++ b/swiftstory/SwiftStory.py @@ -14,7 +14,7 @@ from swiftstory.Status import error game_manager = swiftstory.GameManager.GameManager() -async def message_received_handler(client, websocket, message): +async def message_received_handler(client, message): try: json_msg = json.loads(message) except JSONDecodeError: @@ -57,15 +57,15 @@ async def message_received_handler(client, websocket, message): else: res = error('invalid command') - await websocket.send(res) + await client.socket.send(res) async def swiftstory(websocket, path): client = Client(websocket, game_manager) with contextlib.suppress(websockets.exceptions.ConnectionClosed): - async for message in websocket: - await message_received_handler(client, websocket, message) + async for message in client.socket: + await message_received_handler(client, message) await client.disconnect() -- cgit v1.2.3