Nochmal
This commit is contained in:
parent
36e5acb7e9
commit
af8547b3d6
24
index.js
24
index.js
@ -34,21 +34,21 @@ wss.on("connection", function connection(ws) {
|
||||
|
||||
ws.on("message", function message(data, isBinary) {
|
||||
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 {
|
||||
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);
|
||||
|
||||
switch (message.action) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user