Hello working

This commit is contained in:
“bobbydigitales”
2024-10-09 12:20:16 -07:00
parent 26ed3bcf84
commit dd66a5d31b
4 changed files with 22 additions and 10 deletions

View File

@@ -174,6 +174,7 @@ class wsConnection {
this.websocket.send(json);
}
helloResponseHandler(data) {
debugger;
let users = [];
try {
let currentUserPeers = data.userPeers[app.router.userID];
@@ -186,8 +187,8 @@ class wsConnection {
users = [...users, ...Object.entries(data.userPeers)];
log(`Net: got ${users.length} users from bootstrap peer. ${users.join(',')}`);
for (let [userID, peerIDs] of users) {
this.peers.set(userID, [...Object.keys(peerIDs)]);
for (let peerID of [...Object.keys(peerIDs)]) {
this.peers.set(userID, [...peerIDs]);
for (let peerID of [...peerIDs]) {
if (peerID === this.peerID) {
continue;
}
@@ -331,6 +332,7 @@ class wsConnection {
};
this.websocket.onmessage = (event) => {
// log('ws:<-' + event.data.slice(0, 240));
debugger;
let data = JSON.parse(event.data);
let { type } = data;
let handler = this.messageHandlers.get(type);

File diff suppressed because one or more lines are too long