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