mirror of
https://github.com/Yonle/bostr.git
synced 2025-11-19 10:26:34 +01:00
redone log for websocket users
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
@@ -15,6 +15,8 @@ sess.exec("CREATE TABLE IF NOT EXISTS events (cID TEXT, subID TEXT, eID TEXT);")
|
|||||||
// CL - User socket
|
// CL - User socket
|
||||||
module.exports = (ws, req) => {
|
module.exports = (ws, req) => {
|
||||||
ws.id = process.pid + Math.floor(Math.random() * 1000) + "_" + csess.size;
|
ws.id = process.pid + Math.floor(Math.random() * 1000) + "_" + csess.size;
|
||||||
|
|
||||||
|
console.log(process.pid, `->- ${req.headers["x-forwarded-for"]?.split(",")[0] || req.socket.address()?.address} connected as ${ws.id}`);
|
||||||
ws.on("message", data => {
|
ws.on("message", data => {
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ sess.exec("CREATE TABLE IF NOT EXISTS events (cID TEXT, subID TEXT, eID TEXT);")
|
|||||||
module.exports = (ws, req) => {
|
module.exports = (ws, req) => {
|
||||||
ws.id = process.pid + Math.floor(Math.random() * 1000) + "_" + csess.size;
|
ws.id = process.pid + Math.floor(Math.random() * 1000) + "_" + csess.size;
|
||||||
|
|
||||||
console.log(process.pid, `->- ${req.headers["x-forwarded-for"]?.split(",")[0] || req.socket.address()?.address} is now known as ${ws.id}`);
|
console.log(process.pid, `->- ${req.headers["x-forwarded-for"]?.split(",")[0] || req.socket.address()?.address} connected as ${ws.id}`);
|
||||||
ws.on("message", data => {
|
ws.on("message", data => {
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|||||||
1
http.js
1
http.js
@@ -33,7 +33,6 @@ server.on('request', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
server.on('upgrade', (req, sock, head) => {
|
server.on('upgrade', (req, sock, head) => {
|
||||||
log(`${req.headers["x-forwarded-for"]?.split(",")[0] || req.socket.address()?.address} - WS CONN`);
|
|
||||||
wss.handleUpgrade(req, sock, head, _ => handleBouncer(_, req));
|
wss.handleUpgrade(req, sock, head, _ => handleBouncer(_, req));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user