From f27720ef1c769696fbe3d5307154aeff2ceb6db3 Mon Sep 17 00:00:00 2001 From: Remco Date: Tue, 18 Apr 2017 17:51:20 +0200 Subject: [PATCH] COUNT event This is for realtime counting of the clients connected to bezerk --- Bezerk.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Bezerk.js b/Bezerk.js index 614c900..f869f1f 100644 --- a/Bezerk.js +++ b/Bezerk.js @@ -122,6 +122,14 @@ function process (socket, message) { if (msg.c === undefined && msg.op !== 'EVAL_REPLY') { socket.close() Logger('Closing shard connection, no data.') + } else if (msg.op === 'COUNT') { + send({ + op: 'COUNT_REPLY', + c: { + shards: shards.length, + listeners: receivers.length + } + }) } else { Logger('Request accepted, attempting to send data to subscribed listeners.') for (let listener of receivers) {