diff --git a/app.js b/app.js index c88aafd..eace751 100644 --- a/app.js +++ b/app.js @@ -169,10 +169,14 @@ wsServer.on('connection', socket => { }) socket.on('message', async message => { - console.log('socket message') - //socket.send('Loading...') 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 cluster = clusters[message.cluster] const run = async () => consumers.set(socket, await currentMode({