From ac2d3504bdf8c5459a659044b7866977f24a8e72 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Tue, 23 Aug 2022 22:27:08 -0400 Subject: [PATCH] Add kill message handling. Remove 'Loading' message. --- app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index e85e939..65cc6a5 100644 --- a/app.js +++ b/app.js @@ -167,9 +167,14 @@ wsServer.on('connection', socket => { }) socket.on('message', async 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 console.log('CLUSTERS before run', clusters) console.log('message.cluster', message.cluster)