working websocket and bootstrap peer reconnection when connection is lost

This commit is contained in:
2025-05-18 15:11:34 -07:00
parent 404a224bf1
commit 15e595cca1
6 changed files with 257 additions and 93 deletions

View File

@@ -139,6 +139,8 @@ function hello2Handler(m:Hello2Message, socket:WebSocket) {
peerSockets.set(m.peer_id, socket); // TODO:MAYBEBUG - what happens with multiple windows each with their own websocket?
socketPeers.set(socket, m.peer_id);
console.log(userPeers.get(m.user_id));
if (!m.is_bootstrap_peer) {
return JSON.stringify({ type: 'hello2', bootstrapPeers: [...bootstrapPeers.values()] });