Question

What i'm working on is a chat, so i want a database read/display every 1 second and also by submitting a new message. I figured my httprequest doesn't work (doesn't get past readystate 1) because i trigger a new request while an old one isn't finished. Firebug says each request takes more than 1 second:

GET h**p://localhost/php2/projekt/open_blog/load.php 200 OK 1.03s

If i set the interval of the requesting function higher than the needed 1 second to answer it works, but that can't be it. On another machine this happenend instantaneously. I'm running it on xampp anyway. Is this some php.ini setting i am missing? How would that work out on an actual online server?

And why can't several request happen at the same time anyway? The object is inside a function, so every one is a new unique one.

Was it helpful?

Solution

Don't make a new request until the first one is finished. It's entirely possible for a request to take a second, or 5.

You might also look at something like Socket.IO which uses Websockets, or emulates them when needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top