From e8c6b6f47da8d3a6593d5be31b7e456220544c12 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 14 Oct 2026 09:23:31 -0500 Subject: [PATCH] add docstrings --- frigate/comms/ws.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frigate/comms/ws.py b/frigate/comms/ws.py index 6c62c3baad..5f9cb96f59 100644 --- a/frigate/comms/ws.py +++ b/frigate/comms/ws.py @@ -482,6 +482,8 @@ class WebSocket(WebSocket_): # type: ignore[misc] self._aborted = False def opened(self) -> None: + """Set a send timeout on the socket and start this client's writer thread.""" + # ws4py writes close and pong frames on the shared manager thread, so a # stalled client must not block sendall forever. SO_SNDTIMEO leaves recv # (and idle clients) untouched, unlike settimeout(). @@ -497,6 +499,11 @@ class WebSocket(WebSocket_): # type: ignore[misc] self._writer.start() def send(self, payload: Any, binary: bool = False) -> None: + """Queue a message for this client's writer thread. + + Returns without waiting for delivery. Disconnects the client if its queue + is full. + """ try: self._send_queue.put_nowait((payload, binary)) except queue.Full: @@ -532,6 +539,7 @@ class WebSocket(WebSocket_): # type: ignore[misc] pass def closed(self, code: int, reason: str | None = None) -> None: + """Signal the writer thread to exit.""" try: self._send_queue.put_nowait(None) except queue.Full: