zebra-spaces: send 'bye' on explicit leave so server skips hiccup grace
Matches signal commit 0547b4c. The leave button now sends a 'bye' message before closing the WS — the server distinguishes a strong leave from a hiccup, and we want the strong-leave path here. Without the bye, an explicit leave would defer peer-left for 8s and other peers would see the user's tiles + mesh PCs linger.
This commit is contained in:
parent
0878996e96
commit
56b7bfb187
1 changed files with 12 additions and 3 deletions
|
|
@ -3813,7 +3813,16 @@ $('btn-leave').addEventListener('click', async () => {
|
|||
try { sessionStorage.removeItem(ACTIVE_CAM_KEY); } catch(_){}
|
||||
if (sigReconnect){ clearTimeout(sigReconnect); sigReconnect = null; }
|
||||
for (const u of [...peers.keys()]) tearPeer(u);
|
||||
if (ws){ try { ws.close(); } catch(_){} ws = null; }
|
||||
/* send 'bye' BEFORE closing the WS — server distinguishes a strong
|
||||
* leave (user clicked leave / closed tab) from a hiccup disconnect
|
||||
* (refresh, network blip). On bye, the server broadcasts peer-left
|
||||
* immediately; without it, the server defers the broadcast behind an
|
||||
* 8s grace so a refresh can rejoin invisibly. */
|
||||
if (ws){
|
||||
try { ws.send(JSON.stringify({ type: 'bye' })); } catch(_){}
|
||||
try { ws.close(); } catch(_){}
|
||||
ws = null;
|
||||
}
|
||||
await sfuUnpublish(); await sfuUnpublishScreen(); await sfuUnpublishCamera(); await sfuUnsubscribe();
|
||||
dropMic();
|
||||
members.clear(); handraise.clear(); myUUID=''; myRole=''; hostUUID=''; outstandingInvite=null;
|
||||
|
|
@ -3845,8 +3854,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');
|
|||
|
||||
<footer style="margin:2.2rem auto 0;font-size:0.65rem;color:#999;line-height:1.7;word-break:break-all;font-family:monospace">
|
||||
<span id="pi-seal" style="color:#777;cursor:default;user-select:none" title="">page integrity</span> · built <span class="stamp-date">2026-06-03</span><br>
|
||||
md5 <span class="stamp-md5">e7d4557587a42469e48e836866e4cc56</span><br>
|
||||
sha256 <span class="stamp-sha">027a8b232ffdcb7333dc18a1bf8f14ae68b582e3c7e9d9824288821ab80886dc</span><br>
|
||||
md5 <span class="stamp-md5">23233fe6c11383cddc6088f564b9b95c</span><br>
|
||||
sha256 <span class="stamp-sha">ce79d23b6db5bf5c37efa084da4210d7318854198d92806fc7371ad80fd15d6a</span><br>
|
||||
<span style="color:#bbb">hashes are of this page with these two fields zeroed — to verify, blank them and re-hash</span><br>
|
||||
<span style="color:#bbb">one self-contained file — <strong>save a copy</strong> and verify against these hashes; point at your own servers with ?signal= and ?turncred=, or <a href="host-your-own.html" style="color:#999">host your own community</a></span>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue