From fa0d10c05504f9e7038212624553b7673245f991 Mon Sep 17 00:00:00 2001 From: Remco Date: Tue, 20 Mar 2018 14:19:58 +0100 Subject: [PATCH] COUNT event --- index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/index.js b/index.js index c86d5ec..00704af 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,16 @@ function handle (socket, msg) { return socket.close(4001) // JSON_DECRYPT_ERROR } switch (msg.op) { + case '1050': { // COUNT + send(socket, { + op: '1051', + c: { + shards: Array.from(Server.clients).filter(x => x.type === 'shard').length, + listeners: Array.from(Server.clients).filter(x => x.type === 'listener').length + } + }) + break + } case '1003': { // IDENTIFY_SUPPLY if (socket.type) return socket.close(4002) // ALREADY_AUTHENTICATED if (msg.c.secret === secret) {