Initializes a new instance of the Watchdog class.
The player this watchdog is monitoring.
The current rate of operations within the last second.
The one second interval for zeroing currentRate.
Cleared by Watchdog.destroy.
The maximum allowed rate of operations before disconnecting the player.
The player being monitored.
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 currentRate 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 rateOperation method is used to increment my current rate. If current rate goes beyond my limit, I will disconnect my player. I set my current rate to zero on a one second interval.