Jump to content

Recommended Posts


PHP Websockets Rate limiter (Thanks to @Kicken for the help)

 

How do I setup let's say... no more than 5 requests per second?  Any idea?

 

// anti flood protection
if (isset($users[$clientID]['last_session_request'])) {
if($users[$clientID]['last_session_request'] > ''.microtime(true).'' - 1){
// users will be redirected to this page if it makes requests faster than 1 seconds
echo "Limit Reached... Simmer down!";
wsClose($clientID);
}else{
 
 
}
$users[$clientID]['last_session_request'] = microtime(true);
}

 
Edited by Monkuar
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.