deno server

This commit is contained in:
bobbydigitales
2024-10-09 20:03:57 -07:00
parent 26ed3bcf84
commit 101f8e15b2
5 changed files with 238 additions and 164 deletions

View File

@@ -251,7 +251,7 @@ class wsConnection {
}
helloResponseHandler(data: any) {
debugger
let users = [];
try {
let currentUserPeers = data.userPeers[app.router.userID];
@@ -265,9 +265,9 @@ class wsConnection {
log(`Net: got ${users.length} users from bootstrap peer. ${users.join(',')}`)
for (let [userID, peerIDs] of users) {
this.peers.set(userID, [...Object.keys(peerIDs as any)]);
this.peers.set(userID, [...peerIDs]);
for (let peerID of [...Object.keys(peerIDs as any)]) {
for (let peerID of [...peerIDs]) {
if (peerID === this.peerID) {
continue;
}
@@ -323,6 +323,7 @@ class wsConnection {
// }
async getPostIdsForUserHandler(data: any) {
debugger;
let message = data.message;
let postIds = await getAllIds(message.user_id) ?? [];
if (postIds.length === 0) {
@@ -449,7 +450,7 @@ class wsConnection {
this.websocket.onmessage = (event) => {
// log('ws:<-' + event.data.slice(0, 240));
debugger;
let data = JSON.parse(event.data);
let { type } = data;