From 1d9ec6bd4f0f6dd3b73f6a70f2b49c400c8aa956 Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Fri, 26 Mar 2021 16:13:24 +0530 Subject: [PATCH] attempt 2 --- src/ws/streams.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ws/streams.js b/src/ws/streams.js index a65464c..856685b 100644 --- a/src/ws/streams.js +++ b/src/ws/streams.js @@ -36,12 +36,14 @@ const recvUpdate = async (channel, data) => { } const sendInitial = async (id) => { - const c = connections[id] - const stream = await crud['streams'].getById(c.streamid) - c.connection.send(JSON.stringify({ - event: 'streams:read', - data: stream, - })) + if (id != null || id != '') { + const c = connections[id] + const stream = await crud['streams'].getById(c.streamid) + c.connection.send(JSON.stringify({ + event: 'streams:read', + data: stream, + })) + } } module.exports = {