This commit is contained in:
Timo Reichl 2025-03-30 14:46:30 +02:00
parent 36e5acb7e9
commit af8547b3d6

View File

@ -34,6 +34,9 @@ wss.on("connection", function connection(ws) {
ws.on("message", function message(data, isBinary) { ws.on("message", function message(data, isBinary) {
console.log("received a new message"); console.log("received a new message");
try {
let message = JSON.parse(data);
if ( if (
message.filter && message.filter &&
message.filter._id && message.filter._id &&
@ -46,9 +49,6 @@ wss.on("connection", function connection(ws) {
console.error("Invalid ObjectId in filter:", e); console.error("Invalid ObjectId in filter:", e);
} }
} }
try {
let message = JSON.parse(data);
console.log("message action is " + message.action); console.log("message action is " + message.action);
switch (message.action) { switch (message.action) {