Update app.py
This commit is contained in:
parent
1187e59aa4
commit
d329248e49
1 changed files with 9 additions and 1 deletions
10
app.py
10
app.py
|
|
@ -443,12 +443,20 @@ async def index(request: Request):
|
|||
const socket = new WebSocket(wsUrl);
|
||||
let start;
|
||||
socket.onopen = () => {{ start = performance.now(); socket.send("ping"); }};
|
||||
socket.onmessage = () => {{
|
||||
|
||||
socket.onmessage = (event) => {{
|
||||
try {{
|
||||
const msg = JSON.parse(event.data);
|
||||
if (msg.type === "mss_report") return;
|
||||
}} catch(e) {{
|
||||
}}
|
||||
|
||||
const lat = Math.round(performance.now() - start);
|
||||
el.textContent = lat + " MS";
|
||||
el.classList.remove('loading');
|
||||
socket.close();
|
||||
}};
|
||||
|
||||
socket.onerror = () => {{ el.textContent = "{t['stat_err']}"; }};
|
||||
}} catch(e) {{ el.textContent = "{t['stat_err']}"; }}
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue