summaryrefslogtreecommitdiff
path: root/swiftstory/SwiftStory.py
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2020-05-21 23:24:47 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2020-05-21 23:24:47 +0200
commit40d54a78a6cfb510bfca30d9ab5cdb01f7956548 (patch)
treef9796bfaec9e03b98089ea4957673ecf5b000cd2 /swiftstory/SwiftStory.py
parent0440659ec64c923a0c26188666f3c68121501400 (diff)
Don't pass both the client and the socket
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/SwiftStory.py')
-rw-r--r--swiftstory/SwiftStory.py8
1 files 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()