From 61b1534b8a260b41a60a36b57e19f7b5f2c809d1 Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Wed, 21 Sep 2022 16:08:59 +0200 Subject: [PATCH] add debug logging for websockets --- routes/api/post.js | 2 ++ server.js | 1 + 2 files changed, 3 insertions(+) diff --git a/routes/api/post.js b/routes/api/post.js index bc39a25..dd79014 100644 --- a/routes/api/post.js +++ b/routes/api/post.js @@ -212,7 +212,9 @@ export const setup = function (router, con, server) { data: post_obj }; let messagestr = JSON.stringify(message); + console.log(5,server.wss.clients); server.wss.clients.forEach(function(ws) { + console.log(5,ws); ws.send(messagestr); }); res.json({ "success": "successfully posted message" }); diff --git a/server.js b/server.js index 94b6d74..f6de644 100644 --- a/server.js +++ b/server.js @@ -1210,6 +1210,7 @@ wss = new WebSocket({ }); wss.on("connection", function connection(ws) { ws.channel = "everyone"; + console.log(5,"new connection"); ws.on("message", function incoming(message) { message = JSON.parse(message); if (message.id == "switchChannel") {