version 1.0
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user