From a5ead194e426ae3161f63da322fa15e8c0bfeccc Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Fri, 26 Mar 2021 15:58:15 +0530 Subject: [PATCH] attempt to make streams handler more watertight --- src/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index c64ad89..d503026 100644 --- a/src/index.js +++ b/src/index.js @@ -48,11 +48,11 @@ server.on('upgrade', (req, socket, head) => { wss1.emit('connection', socket, req) }) } else if (pathname[1] === 'stream') { - wss2.handleUpgrade(req, socket, head, (socket) => { - if (req.id != null || req.id != '') { - req.id = token - wss2.emit('connection', socket, req) - } - }) + if (token != null || token != '' || token != "") { + wss2.handleUpgrade(req, socket, head, (socket) => { + req.id = token + wss2.emit('connection', socket, req) + }) + } } }) \ No newline at end of file