This commit is contained in:
Jens Ullmert 2022-07-27 16:58:08 +02:00
parent 2a67fb36e7
commit 0abbe41473

View File

@ -238,10 +238,8 @@ async def websworker(websocket, path):
try: try:
await websocket.send(state_event()) await websocket.send(state_event())
while True: while True:
try: # waiting for a new message resceived on the websocket
message = await websocket.recv()
# waiting for a new message received on the websocket
message = await asyncio.wait_for(websocket.recv(), timeout=0.1)
# split message from multiple commands in one string # split message from multiple commands in one string
data = message.split(";") data = message.split(";")
@ -275,6 +273,10 @@ async def websworker(websocket, path):
print("DMX value for channel " + act[0] + " changed to " + act[1]) print("DMX value for channel " + act[0] + " changed to " + act[1])
# It does not look like we have a dmx key-value, so we have to process the command # It does not look like we have a dmx key-value, so we have to process the command
except Exception: except Exception:
@ -288,7 +290,6 @@ async def websworker(websocket, path):
else: else:
print("received message, but can not handle: ", act) print("received message, but can not handle: ", act)
finally: finally:
await unregister(websocket) await unregister(websocket)