Initializes a new instance of the Watchdog class.
The player this watchdog is monitoring.
The current rate of operations within the last second.
The maximum allowed rate of operations before disconnecting the player.
Performs cleanup by clearing the interval used to reset Watchdog.currentRate.
Increments the current rate of operations by the specified amount. If the current rate exceeds the limit, the player is disconnected.
Optionalamount: number = 1The amount to increment the current rate by. Default is 1
Returns true if the player was disconnected due to exceeding the limit, otherwise false.
I keep track of client activity. My Watchdog.rateOperation method is used to increment my Watchdog.currentRate. If Watchdog.currentRate goes beyond my Watchdog.limit, I will disconnect my Watchdog.player. I set Watchdog#currentRate to zero on a one second interval.