From 8d5bc05cf7e3631a85d8108864c66a25b3e5ac67 Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Fri, 19 Mar 2021 13:45:12 +0530 Subject: [PATCH] handle streams:full properly --- src/ws/handler.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ws/handler.js b/src/ws/handler.js index b11aa30..47aa53a 100644 --- a/src/ws/handler.js +++ b/src/ws/handler.js @@ -34,6 +34,7 @@ const handleMsg = async (msg, id) => { data: await crud[channel].getAll(), } if (channel === 'streams' && d.subscribe === 'streams:full') { + dm.event = 'streams:full' dm.data = await crud[channel].getAllPop() } connections[id].connection.send(JSON.stringify(dm)) @@ -75,6 +76,12 @@ const fanoutMsg = (channel, data) => { data, } connections[k].connection.send(JSON.stringify(d)) + } else if (connections[k].events.indexOf(`streams:full`) !== -1) { + const d = { + event: `streams:full`, + data, + } + connections[k].connection.send(JSON.stringify(d)) } }) }