Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Commit

Permalink
COUNT event
Browse files Browse the repository at this point in the history
  • Loading branch information
Dougley committed Mar 20, 2018
1 parent 0eb770d commit fa0d10c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fa0d10c

Please sign in to comment.