diff --git a/frigate/comms/ws.py b/frigate/comms/ws.py index 98f24cf28..fccd8db5c 100644 --- a/frigate/comms/ws.py +++ b/frigate/comms/ws.py @@ -38,6 +38,7 @@ class WebSocketClient(Communicator): # type: ignore[misc] def __init__(self, config: FrigateConfig) -> None: self.config = config + self.websocket_server = None def subscribe(self, receiver: Callable) -> None: self._dispatcher = receiver @@ -98,6 +99,10 @@ class WebSocketClient(Communicator): # type: ignore[misc] logger.debug(f"payload for {topic} wasn't text. Skipping...") return + if self.websocket_server is None: + logger.debug("Skipping message, websocket not connected yet") + return + try: self.websocket_server.manager.broadcast(ws_message) except ConnectionResetError: