diff options
| author | Adam Soltys <[email protected]> | 2020-05-18 21:37:42 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-05-18 21:37:42 -0700 |
| commit | 32f85a740f22460c4be8a79b7aeb0dfba0071689 (patch) | |
| tree | acba2fdade999252af1d724b1ef02ea3d828f0b1 /lib | |
| parent | 247d86a0a3425f493ef684406898a59a47a60843 (diff) | |
| download | coinos-server-32f85a740f22460c4be8a79b7aeb0dfba0071689.tar.gz coinos-server-32f85a740f22460c4be8a79b7aeb0dfba0071689.zip | |
log ip of failed socket
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sockets.js | 10 |
1 files 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); } }); |
