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
This is for realtime counting of the clients connected to bezerk
  • Loading branch information
Dougley committed Apr 18, 2017
1 parent a2ba6d4 commit f27720e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Bezerk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f27720e

Please sign in to comment.