Add kill message handling.

Remove 'Loading' message.
This commit is contained in:
Sage Vaillancourt 2022-08-23 22:27:08 -04:00
parent 61b5da846a
commit ac2d3504bd
1 changed files with 6 additions and 1 deletions

7
app.js
View File

@ -167,9 +167,14 @@ wsServer.on('connection', socket => {
}) })
socket.on('message', async message => { socket.on('message', async 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
console.log('CLUSTERS before run', clusters) console.log('CLUSTERS before run', clusters)
console.log('message.cluster', message.cluster) console.log('message.cluster', message.cluster)