gs: more error catching
This commit is contained in:
parent
5beb79b51b
commit
3cda1316ae
@ -209,6 +209,7 @@ async def new_boat(boatId, name, ws):
|
|||||||
async def run(ws, path):
|
async def run(ws, path):
|
||||||
"""hadeler for every new websocket connection"""
|
"""hadeler for every new websocket connection"""
|
||||||
client = None
|
client = None
|
||||||
|
try:
|
||||||
async for msg in ws:
|
async for msg in ws:
|
||||||
for message in msg.split("\n"):
|
for message in msg.split("\n"):
|
||||||
if len(message) == 0:
|
if len(message) == 0:
|
||||||
@ -249,6 +250,8 @@ async def run(ws, path):
|
|||||||
print("INFO: boat " + client['id'] + ": disconnected")
|
print("INFO: boat " + client['id'] + ": disconnected")
|
||||||
client['state'] = "terminated"
|
client['state'] = "terminated"
|
||||||
break
|
break
|
||||||
|
except websockets.exceptions.ConnectionClosed:
|
||||||
|
print("INFO: connection disconected")
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
"""main"""
|
"""main"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user