What is best way to limit the frequency of chat messages sent by players?


If a user sends the messages too frequently, it overloads the server and spams the channel. What is the most efficient way to control that from server side? For example, only allows user to send maximum one message per second. Do I have to record the last chat message timestamp sent by each user and perform a check in the before hook of every new message? Or is there a better way to reject when user requests too often?


Hi, I think you’re on a right path in terms of storing the timestamp on each message and then perform a check in the before hook. Certainly there is no built-in configuration to throttle / limit message frequency. How strong is your requirement for the solution to be server-side ? Client-side would offer multiple ways of achieving some kind of throttling.


Thank you to the confirmation.

Yes, the client-side restriction will be implemented. But it is better to have the restriction from server-side as well in case of malicious client.