View Full Version : Execute a js function every 10 seconds.

08-31-2010, 11:24 AM
I didn't post at Javascript's forum, because i need a Server-Side solution.
So, i have a js function which reads a file. I need it to be executed every 10 seconds of the server. Why do i need this ?
I have to make a trivia chat. I have a bot in a php file, and i need the file to be read every 10 seconds of the server. I already have that function
Why 10 seconds of the server ?
Because, let's say there are 2 people on the chat. The file should be read at the same time for they both. So, if the first one enters now, and another one enters over 3 seconds, the function should be executed at the same time.
So, it doesn't work with javascript, with setTimeout/Interval, because the function will run for both on different times.
If it can't be done with that function, i can put that function in another file. So i need that file to be read every 10 seconds of the server...
Somebody gave me that php code, to see how many seconds remained until the 10 seconds interval ends ( <?php echo ceil(time()%10); ?> ). Can i use it ?
Please help. I can help the guy who helped me with 5-7 euros/$ on paypal. I didn't fin any bidder on vWorker :(

09-01-2010, 10:21 AM
I don't need it anymore.
I left the project...