Skip to content

Commit

Permalink
chore: debug broadcastMessage on prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Dec 4, 2024
1 parent 6a52d8d commit cbd3e84
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions modules/socket/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ export default function socketModule(s: Fastro) {
console.log("joinRoom-data", data);
if (data.user) {
connected?.set(data.user, { data, socket });
return true;
}

return false;
}

const injectData = async (ctx: Context, data: Data) => {
Expand Down Expand Up @@ -93,9 +90,8 @@ export default function socketModule(s: Fastro) {

socket.onmessage = async (event) => {
const data: Data = JSON.parse(event.data);
const res = await joinRoom(ctx, socket, data);
console.log("socket.onmessage-res", res);
if (res && data.type === "ping") {
if (data.type === "ping") {
await joinRoom(ctx, socket, data);
return await broadcastConnection(ctx, data);
}
if (data.type === "message" && data.message?.msg !== "") {
Expand Down

0 comments on commit cbd3e84

Please sign in to comment.