fix: 'ip' is possibly 'undefined'

This commit is contained in:
Siyuan Miao 2025-02-11 13:51:51 +01:00
parent 771e1488d4
commit ab2e65c144

View File

@ -250,7 +250,7 @@ export const registerWebsocketServer = (server: any) => {
process.env.REAL_IP_HEADER && req.headers[process.env.REAL_IP_HEADER] process.env.REAL_IP_HEADER && req.headers[process.env.REAL_IP_HEADER]
) || req.socket.remoteAddress; ) || req.socket.remoteAddress;
activeConnections.set(id, [ws, ip.toString()]); activeConnections.set(id, [ws, `${ip}`]);
console.log("New socket for id", id); console.log("New socket for id", id);
ws.on("error", async () => { ws.on("error", async () => {