Only allow bytes thru websocket

This commit is contained in:
Emily 2019-08-01 19:06:01 +02:00
parent dc98b5e6d5
commit 2abf9fd7f0

View File

@ -134,7 +134,9 @@ async def handle(ws, path):
await subscribe_flight(struct.pack(b"<I?", int(path), True)) await subscribe_flight(struct.pack(b"<I?", int(path), True))
while not cli.ws.closed: while not cli.ws.closed:
async for data in cli.ws: async for data in cli.ws:
#data = data.encode() # For some reason or another... websockets module returns a string instead of bytes? if type(data) != bytes:
await send_error(b"Bytes are required")
else:
await query(data) await query(data)
await asyncio.sleep(.1) await asyncio.sleep(.1)