feat(net): F3 network overlay - ping graph and where lag comes from (you, opponent, server)
This commit is contained in:
@@ -129,6 +129,7 @@
|
||||
s.onopen = () => s.send(JSON.stringify({ t: 'hello', v: RC.Proto.VERSION, token: t }));
|
||||
s.onmessage = ev => {
|
||||
let msg; try { msg = JSON.parse(ev.data); } catch (e) { return; }
|
||||
msg._bytes = ev.data.length; // for the network overlay (bandwidth)
|
||||
if (msg.t === 'welcome') { isOpen = true; backoff = 1000; emit('open', msg); }
|
||||
if (msg.t === 'error' && (msg.code === 'OUTDATED' || msg.code === 'REPLACED')) { want = false; emit(msg.code === 'OUTDATED' ? 'outdated' : 'replaced', msg); }
|
||||
if (msg.t === 'error' && msg.code === 'UNAUTH' && session) session.exp = 0; // refresh before the retry
|
||||
|
||||
Reference in New Issue
Block a user