add verify before ws connection

This commit is contained in:
锦恢 2025-05-16 20:37:18 +08:00
parent a3a4f2b5cb
commit a1bcd06acd

View File

@ -119,11 +119,7 @@ const wss = new WebSocketServer(
port: 8282,
verifyClient: (info, callback) => {
console.log(info.req.url);
const ok = verifyToken(info.req.url || '');
console.log(ok);
const ok = verifyToken(info.req.url || '');
if (!ok) {
callback(false, 401, 'Unauthorized: Invalid token');