mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Simplify on connect (#11176)
This commit is contained in:
parent
461442b399
commit
90bdb07463
@ -50,10 +50,6 @@ 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"))
|
||||
|
@ -65,7 +65,13 @@ function useValue(): useValueReturn {
|
||||
setWsState({ ...wsState, [data.topic]: data.payload });
|
||||
}
|
||||
},
|
||||
onOpen: () => {},
|
||||
onOpen: () => {
|
||||
sendJsonMessage({
|
||||
topic: "onConnect",
|
||||
message: "",
|
||||
retain: false,
|
||||
});
|
||||
},
|
||||
shouldReconnect: () => true,
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user