let me study more tomorrow and elaborate more on the question thread. on my second thought what i want was not a delay in 301 response. what i really want was real resource, say video/mp4 after routes.php's 301.
If the goal is waiting on a response from a 3rd party service or stream there are lots of ways to do it without sleeping.
The most commonly used method for this is using event listeners usually on state changes.
This is very common in Ajax loading and looks something like this.
var my_request = new XMLHttpRequest();
//create a function that fires each time the request state changes
my_request.onreadystatechange = function()
{
// check to see if the state of the request is ready and valid
if (this.readyState == 4 && this.status == 200)
{
var response = this.responseText;
alert(response);
}
}
my_request.open("get", "http://localhost/", true);
my_request.send()
You can also do this with CURL in php..... I am not sure if this is what you are needing though.
I end up doing like DrPrez's recommendation, sleep(). I'll have to keep studying how to throttle the actual resource response at server side.
Thanks for your idea. I think you meant setTimeOut in if test block. What I want was delay in server side, not in client side. Anyway thanks a lot.
IanSirkit said:
Update: I was not good at what I wanted to. I should have titled this as 'Throttle response throughput' or something. Anyway I found a solution and made it through nginix config. Thanks community.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community