count messages when sent
after a message is sent, increment a counter for each channel:
- command messages/responses
- broadcast messages (multiply each message sending by number of subscribers sent to)
implementation note:
- both
broadcast
andrespond
dispatch tocountMessage
including amessageType
param, which may beBROADCAST_MESSAGE
orCOMMAND_RESPONSE
-
countMessage
counts both incoming and outgoing messages- it increments a counter by 1 for all incoming messages and for outgoing command responses
- for outgoing broadcast messages, it increments a counter by N, where N is the number of subscribers to the channel
bonus: refactor awkward prefix override implementation by passing command: COMMAND_TYPE
in commandResult
, then dispatch off this to avoid prefixing RENAME
responses
Edited by aguestuser