Update session display
This commit is contained in:
parent
940fed4bdf
commit
785504ab6c
2
main.py
2
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=}')
|
||||
|
@ -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(', ');
|
||||
}
|
||||
};
|
4
ui.html
4
ui.html
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user