|
|
@ -45,12 +45,14 @@ server.on('upgrade', (req, socket, head) => {
|
|
|
|
if (pathname[1] === 'ws' && get(token)) {
|
|
|
|
if (pathname[1] === 'ws' && get(token)) {
|
|
|
|
wss1.handleUpgrade(req, socket, head, (socket) => {
|
|
|
|
wss1.handleUpgrade(req, socket, head, (socket) => {
|
|
|
|
req.id = token
|
|
|
|
req.id = token
|
|
|
|
wss1.emit('connection', socket, req);
|
|
|
|
wss1.emit('connection', socket, req)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else if (pathname[1] === 'stream') {
|
|
|
|
} else if (pathname[1] === 'stream') {
|
|
|
|
wss2.handleUpgrade(req, socket, head, (socket) => {
|
|
|
|
wss2.handleUpgrade(req, socket, head, (socket) => {
|
|
|
|
req.id = token
|
|
|
|
if (req.id != null || req.id != '') {
|
|
|
|
wss2.emit('connection', socket, req);
|
|
|
|
req.id = token
|
|
|
|
|
|
|
|
wss2.emit('connection', socket, req)
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|