ctucx.git: smartied

[nimlang] smarthome server

commit c34b63eaf65d687c095b4eaaeb0d697ca3a3c5ce
parent 3acc037f42838b3eaa1b12e3c4c6cb7b80619f7a
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 26 Feb 2021 22:45:18 +0100

send server state on subscription
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/frontend.nim b/src/frontend.nim
@@ -32,6 +32,7 @@ proc processWsClient(req: Request) {.async,gcsafe.} =
             if action.subscribed:
               echo "adding client: " & ws.key
               subscribedConnections.add(ws)
+              await ws.send($(%*server.state))
             else:
               echo "removing client: " & ws.key
               subscribedConnections.keepIf(proc(x: Websocket): bool = x.key != ws.key)