refactor fix

main v1.2.3
Ayush Mukherjee 4 years ago
parent eaea84fde0
commit e67493c13d

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

@ -37,13 +37,11 @@ const recvUpdate = async (channel, data) => {
const sendInitial = async (id) => {
const c = connections[id]
if (c.streamid !== null) {
const stream = await crud['streams'].getById(c.streamid)
c.connection.send(JSON.stringify({
event: 'streams:read',
data: stream,
}))
}
}
module.exports = {

Loading…
Cancel
Save