upgrade(req) { console.log(this) let session = ''; const cookies = req.headers.cookie.split(';') as string[]; cookies.forEach(el => { if(el.includes('session=')) session = el.split('session=')[1].trim(); }) if(session == '') { // socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n'); // socket.destroy(); return; } return {headers: {}}; },