A very *simple* solution would be to add a counting variable on the client end. For instance if they send 10 messages in less than 2 seconds its probably spam. Another thing you could do is have a history (again keeping it simple). Check to see if the last thing they sent is equal to the current one sent. If it is, they sent the same thing twice... Those are again simple methods. The use of both in an app would kill scrollers and spammers... but would be easy to overcome (for people bent on spamming).
Everytime a message is sent out from the client, you could add 1 to the variable and call a function. Say you put a limit of 10 messages per 4 seconds, the function would check the variable and then decide whether 10 have been sent in the 4 seconds. If it has then the function could return true, if not, false. To reset the variable, have timer set to execute every 4 seconds and write the variable back to 0.
Note: This is not a sure fire way of checking for spam, but is down cut down on it by alot. Again if you didnt want to get complicated, use a history and a counter to have a very simple filter. Since both are put client side, it also creates less stress on the server.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.