diff --git a/src/controller/lobbyClient.py b/src/controller/lobbyClient.py index 9f8cd35..59fffa2 100644 --- a/src/controller/lobbyClient.py +++ b/src/controller/lobbyClient.py @@ -4,7 +4,7 @@ from typing import Callable, Any, TYPE_CHECKING, Union from pydantic import ValidationError from websockets.server import WebSocketServerProtocol -from websockets.exceptions import ConnectionClosedOK +from websockets.exceptions import ConnectionClosedOK, ConnectionClosedError from netcode.models import Message, LoginMessage, MessageType @@ -71,9 +71,11 @@ class LobbyClientController: data="login", ) ) - - async for message in self.websocket: - await self.on_message(message) + try: + async for message in self.websocket: + await self.on_message(message) + except ConnectionClosedError: + print("Connection Closed Error") async def close(self): """Remove self from Lobby broadcasting list"""