Some things.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user