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

View File

@ -34,21 +34,21 @@ 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");
if (
message.filter &&
message.filter._id &&
typeof message.filter._id === "string"
) {
try {
message.filter._id = new ObjectId(message.filter._id);
console.log(message.filter._id);
} catch (e) {
console.error("Invalid ObjectId in filter:", e);
}
}
try { try {
let message = JSON.parse(data); let message = JSON.parse(data);
if (
message.filter &&
message.filter._id &&
typeof message.filter._id === "string"
) {
try {
message.filter._id = new ObjectId(message.filter._id);
console.log(message.filter._id);
} catch (e) {
console.error("Invalid ObjectId in filter:", e);
}
}
console.log("message action is " + message.action); console.log("message action is " + message.action);
switch (message.action) { switch (message.action) {