version 1.0

This commit is contained in:
diyaa
2026-07-26 21:43:39 +02:00
parent 833a9bfec2
commit e973d850ed
5 changed files with 59 additions and 1 deletions
+7
View File
@@ -417,6 +417,13 @@ wss.on('connection', (ws) => {
send(ws, { type: 'auth.ok', peerID });
console.log(`[ws] connected: ${peerName} (${peerID})`);
// Notify the partner that this peer is now online
const partnerIDOnAuth = peerPartnerID(session, peerID);
const partnerConnOnAuth = connections.get(partnerIDOnAuth);
if (partnerConnOnAuth?.ws.readyState === 1) {
send(partnerConnOnAuth.ws, { type: 'peer.joined', peerID, peerName });
}
// Deliver messages that arrived while this peer was offline
flushQueue(peerID, ws);
return;