Update session display

This commit is contained in:
Kai Vogelgesang 2020-04-17 02:25:12 +02:00
parent 940fed4bdf
commit 785504ab6c
3 changed files with 9 additions and 5 deletions

View File

@ -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=}')

View File

@ -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(', ');
}
};

View File

@ -9,8 +9,8 @@
<body>
this is the UI
<br>
<span id="current_session">You are not in any session.</span>
<br>
<span id="current_session">You are not in any session.</span><br>
<span id="all_sessions"></span><br>
<br>
<button id="btn_create_session">Create session</button>
<br><br><br>