aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sockets.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sockets.js b/lib/sockets.js
index 7c912d2d..c7b58452 100644
--- a/lib/sockets.js
+++ b/lib/sockets.js
@@ -39,6 +39,7 @@ wss.on("connection", function (ws) {
const id = uuidv4();
ws.on("message", async (token) => {
+ if (!token) return;
try {
const username = jwt.decode(token).username;
if (!sockets[username]) sockets[username] = {};
@@ -48,9 +49,9 @@ wss.on("connection", function (ws) {
ws.send(JSON.stringify({ type: "networks", data: networks }));
ws.send(JSON.stringify({ type: "rates", data: app.get("rates") }));
ws.send(JSON.stringify({ type: "login", data: await getUser(username) }));
- l.info("socket open", username);
+ l.info("socket open", username, id);
} catch (e) {
- l.error("problem opening socket", token, e.message);
+ l.error("problem opening socket", token, e.message, id);
}
});