aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/stats.js
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-06-04 09:07:24 +0200
committermarzavec <admin@marzavec.com>2018-06-04 09:07:24 +0200
commite35fff59ba30e78046c9212e74fce9aef56c6e93 (patch)
treec7d3e0cd75f5a6063d629d4295952488907e9562 /server/src/commands/core/stats.js
parentCompleted protocol decoupling (diff)
downloadhackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.tar.gz
hackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.zip
cleaned up and commented modules
Diffstat (limited to 'server/src/commands/core/stats.js')
-rw-r--r--server/src/commands/core/stats.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js
index b9dc002..74bd4a5 100644
--- a/server/src/commands/core/stats.js
+++ b/server/src/commands/core/stats.js
@@ -3,6 +3,7 @@
*/
exports.run = async (core, server, socket, data) => {
+ // gather connection and channel count
let ips = {};
let channels = {};
for (let client of server.clients) {
@@ -18,15 +19,17 @@ exports.run = async (core, server, socket, data) => {
ips = null;
channels = null;
+ // dispatch info
server.reply({
cmd: 'info',
text: `${uniqueClientCount} unique IPs in ${uniqueChannels} channels`
}, socket);
+ // stats are fun
core.managers.stats.increment('stats-requested');
};
exports.info = {
name: 'stats',
description: 'Sends back legacy server stats to the calling client'
-}; \ No newline at end of file
+};