Save initial camera state to update when websocket connects (#11174)

* Send camera state to dispatcher

* Fix logic

* Cleanup

* Send camera activitiy in on connect

* Support reading initial camera state

* Fix key

* Formatting

* Sorting
This commit is contained in:
Nicolas Mowen
2024-04-30 07:09:50 -06:00
committed by GitHub
parent 0080c28c4d
commit 461442b399
9 changed files with 147 additions and 43 deletions
+4
View File
@@ -50,6 +50,10 @@ class WebSocketClient(Communicator): # type: ignore[misc]
class _WebSocketHandler(WebSocket): # type: ignore[misc]
receiver = self._dispatcher
def opened(self) -> None:
"""A new websocket is opened, we need to send an update message"""
threading.Timer(1.0, self.receiver, ("onConnect", "")).start()
def received_message(self, message: WebSocket.received_message) -> None:
try:
json_message = json.loads(message.data.decode("utf-8"))