From 785504ab6cd0bd7f9c203a8cef2b4a87498c4087 Mon Sep 17 00:00:00 2001 From: Kai Vogelgesang Date: Fri, 17 Apr 2020 02:25:12 +0200 Subject: [PATCH] Update session display --- main.py | 2 +- static/renderer.js | 8 ++++++-- ui.html | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 9a891d9..4c089c2 100644 --- a/main.py +++ b/main.py @@ -70,7 +70,7 @@ async def _(request: aiohttp.web.Request): await ws.prepare(request) print(f'[WS] client {client} connected, {ws=}') - model.subscribe(client, ws) + await model.subscribe(client, ws) async for msg in ws: print(f'[WS] incoming message from client {client}, {ws=}, {msg=}') diff --git a/static/renderer.js b/static/renderer.js index edc6e90..b67fe53 100644 --- a/static/renderer.js +++ b/static/renderer.js @@ -7,7 +7,11 @@ ws.onmessage = function(event) { console.log(msg); - if (msg.hasOwnProperty('session')) { - document.getElementById('current_session').innerText = msg.session; + if (msg.hasOwnProperty('currentsession')) { + document.getElementById('current_session').innerText = msg.currentsession; + } + + if (msg.hasOwnProperty('allsessions')) { + document.getElementById('all_sessions').innerText = msg.allsessions.join(', '); } }; \ No newline at end of file diff --git a/ui.html b/ui.html index 2ad2a56..b623d8a 100644 --- a/ui.html +++ b/ui.html @@ -9,8 +9,8 @@ this is the UI
-You are not in any session. -
+You are not in any session.
+