forked from snxraven/LinkUp-P2P-Chat
Trying to fix peer counts
This commit is contained in:
parent
8c54e4ca77
commit
ac2da1524d
4
app.js
4
app.js
@ -67,6 +67,7 @@ async function initialize() {
|
||||
swarm.on('connection', async (connection, info) => {
|
||||
peerCount++;
|
||||
updatePeerCount();
|
||||
console.log('Peer connected, current peer count:', peerCount);
|
||||
|
||||
// Send the current user's icon to the new peer
|
||||
const iconBuffer = await drive.get(`/icons/${userName}.png`);
|
||||
@ -94,6 +95,7 @@ async function initialize() {
|
||||
connection.on('close', () => {
|
||||
peerCount--;
|
||||
updatePeerCount();
|
||||
console.log('Peer disconnected, current peer count:', peerCount);
|
||||
});
|
||||
});
|
||||
|
||||
@ -301,4 +303,4 @@ function toggleSetupView() {
|
||||
setupDiv.classList.toggle('hidden');
|
||||
}
|
||||
|
||||
initialize();
|
||||
initialize();
|
||||
|
Loading…
Reference in New Issue
Block a user