From 32f85a740f22460c4be8a79b7aeb0dfba0071689 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 18 May 2020 21:37:42 -0700 Subject: log ip of failed socket --- lib/sockets.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/sockets.js b/lib/sockets.js index adea1fa3..cc6da34c 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -27,15 +27,15 @@ broadcast = (type, data) => { } }; -server.on("upgrade", function (request, socket, head) { - wss.handleUpgrade(request, socket, head, function (ws) { - wss.emit("connection", ws, request); +server.on("upgrade", function (req, socket, head) { + wss.handleUpgrade(req, socket, head, function (ws) { + wss.emit("connection", ws, req); }); }); const names = {}; -wss.on("connection", function (ws) { +wss.on("connection", function (ws, req) { const id = uuidv4(); setTimeout(() => ws.ok || ws.close(), 2000); @@ -54,7 +54,7 @@ wss.on("connection", function (ws) { l.info("socket open", username, id); } catch (e) { ws.close(); - l.error("problem opening socket", token, e.message, id); + l.error("problem opening socket", token, e.message, id, req.connection.remoteAddress); } }); -- cgit v1.2.3