diff light_bridge.py @ 1:42a494b8ee1a

show report time
author drewp@bigasterisk.com
date Sun, 28 Jan 2024 15:43:54 -0800
parents 5a77696c6dab
children c6fd04e07db0
line wrap: on
line diff
--- a/light_bridge.py	Sun Jan 28 15:32:18 2024 -0800
+++ b/light_bridge.py	Sun Jan 28 15:43:54 2024 -0800
@@ -6,6 +6,7 @@
 from functools import partial
 import json
 import logging
+import time
 
 import background_loop
 from patchablegraph import PatchableGraph
@@ -81,8 +82,8 @@
 
     async def g():
         async for ping in lights.changes():
-            yield json.dumps(lights.to_js())
             await asyncio.sleep(1)
+            yield json.dumps({'now': time.time()} | lights.to_js())
 
     return EventSourceResponse(g())