N
N
nepster-web2015-08-22 13:17:29
JavaScript
nepster-web, 2015-08-22 13:17:29

Node.js how to test fast post sending?

With grief on the floor, I wrote a chat on node.js, and I wanted to secure it a little.
Namely, if the user will bomb the chat, that is, constantly send messages, it would be great to ban him for a couple of minutes.
That is, if I, for example, send 5-10 messages very quickly (almost simultaneously), then I go to rest for 15 minutes.
Actually there are means or approaches what to catch fast sending of messages?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2015-08-22
@twobomb

Well, you can, for example, remember the time of the last message received by the user, and if he sends more and the limit time has not yet passed, for example 200ms (that is, the current time is the last received <= the limit you set), add a +1 counter, otherwise reset it, and if the counter reaches the limit, for example 10, then give a mut for a while or something like that, I came up with it on the go, you can do it differently somehow. Think yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question