Home  >  Article  >  Backend Development  >  How does the websocket server written by swoole limit the flow of a certain client?

How does the websocket server written by swoole limit the flow of a certain client?

WBOY
WBOYOriginal
2016-08-18 09:16:071728browse

For example, after a certain client connects to my websocket server, it keeps sending me spam messages. I want to set it so that the client can only send a message to the websocket server once in ten seconds. How to do this? Is this implemented using code in the server-side script written by swoole or is it prevented at other levels?

Reply content:

For example, after a certain client connects to my websocket server, it keeps sending me spam messages. I want to set it so that the client can only send a message to the websocket server once in ten seconds. How to do this? Is this implemented using code in the server-side script written by swoole or is it prevented at other levels?

DDOS protection cannot be placed on the handler. Think about it, no matter how you process the information sent by the client or filter it, the information has actually been passed to your program and has occupied the resources of the handler. This has achieved the goal of the DDOS attacker.
DDOS protection should at least be done at the firewall level, blocking at the network entrance instead of blocking in the processing program.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn