Implement websocket handler

This commit is contained in:
2025-11-12 19:20:42 +13:00
parent 2b0b83f981
commit 4f413ee4ff

View File

@@ -12,7 +12,7 @@ def web(settings, patterns):
@app.route('/') @app.route('/')
async def index_hnadler(request): async def index_hnadler(request):
mac = wifi.get_mac().hex() mac = wifi.get_mac().hex()
return Template('/index.html').render(settings=settings, patterns=patterns.patterns.keys(), mac=mac) return Template('index.html').render(settings=settings, patterns=patterns.patterns.keys())
@app.route("/static/<path:path>") @app.route("/static/<path:path>")
def static_handler(request, path): def static_handler(request, path):
@@ -35,7 +35,7 @@ def web(settings, patterns):
if data: if data:
# Process the received data # Process the received data
_, status_code = settings.set_settings(json.loads(data), patterns, True) _, status_code = await settings.set_settings(json.loads(data), patterns, True)
#await ws.send(status_code) #await ws.send(status_code)
else: else:
break break