This commit is contained in:
Sage Vaillancourt 2022-08-26 18:51:41 -04:00
commit 3f98892ddd
1 changed files with 6 additions and 2 deletions

8
app.js
View File

@ -169,10 +169,14 @@ wsServer.on('connection', socket => {
}) })
socket.on('message', async message => { socket.on('message', async message => {
console.log('socket message')
//socket.send('Loading...')
message = JSON.parse(message) message = JSON.parse(message)
if (message.mode === 'kill') {
console.log('KILLING SOCKET')
await killConsumer(consumers.get(socket))
consumers.delete(socket)
return
}
const currentMode = message.mode === 'realTime' ? realTimeSearch : search const currentMode = message.mode === 'realTime' ? realTimeSearch : search
const cluster = clusters[message.cluster] const cluster = clusters[message.cluster]
const run = async () => consumers.set(socket, await currentMode({ const run = async () => consumers.set(socket, await currentMode({