aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sockets.js10
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);
}
});