diff --git a/hopper/ws_server.py b/hopper/ws_server.py index 6be46ed..9b6ca2c 100644 --- a/hopper/ws_server.py +++ b/hopper/ws_server.py @@ -5,7 +5,7 @@ from typing import Iterable, Optional import websockets from websockets import WebSocketServerProtocol -from websockets.exceptions import ConnectionClosedOK +from websockets.exceptions import ConnectionClosedOK, ConnectionClosedError from hopper.models.player import Player from hopper.models.product import Product @@ -44,6 +44,10 @@ class WSServer(Thread): # we're expecting nothing from client, but read if client sends a message await websocket.recv() except ConnectionClosedOK: + logging.info(f"Connection closed OK for client: {websocket.id}") + connected = False + except ConnectionClosedError: + logging.info(f"Connection closed error for client: {websocket.id}") connected = False finally: self.connected_clients.remove(websocket)