Some things.

This commit is contained in:
2025-05-23 16:43:45 -04:00
parent 2856c03b46
commit 5282de29a3
2 changed files with 18 additions and 2 deletions

View File

@@ -4,7 +4,16 @@ function setupChatSocket(wss) {
wss.on("connection", (ws) => {
ws.send("Welcome.");
ws.on("message", (message) => {
chatService.broadcast(wss, message, ws);
const data = JSON.parse(message);
if (data["type"] === "send") {
const sendEventPacket = JSON.stringify({
type: "send-event",
data: {
content: data["data"]["content"],
},
});
chatService.broadcast(wss, sendEventPacket, ws);
}
});
});
}