Skip to content

Commit

Permalink
fix: emit power-event on socket connect
Browse files Browse the repository at this point in the history
When initially loading the web-ui, the current state of the target needs
to be transmitted as well. For that, we emit the power-event after
connecting the websocket.

Signed-off-by: Felix Moessbauer <[email protected]>
  • Loading branch information
fmoessbauer authored and chombourger committed Dec 19, 2023
1 parent 8d571b4 commit 9fb8ad2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mtda/www.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def connect():
data = mtda.console_dump()
socket.emit("console-output", {"output": data}, namespace="/mtda")

power = mtda.target_status(session_id())
socket.emit("power-event", {"event": power}, namespace="/mtda")

status, _, _ = mtda.storage_status(session_id())
socket.emit("storage-event", {"event": status}, namespace="/mtda")

Expand Down

0 comments on commit 9fb8ad2

Please sign in to comment.