A few years ago i made am webbapp with ajax and php, i really loved the polling mechanism.
Now i`m working on a streamingserver which is controlled by php. The client makes a call to the php to start en stop streaming. These are calls the clients initialises, now i want to do some “server-maintenace”. (which is not initialized by a client)
What i’m trying to do is creating a script thats check for clients, the script needs to loop and query`s the database for the clients table every 20 seconds,
is this possible with using PHP only? can you give me some tricks and tips?
help is appreciated
If you want it to be under a minute you’ll need a long running PHP process. If you can live w/ every minute, a cron job will suffice. Another option would be to run the check as part of requests as they came into the webserver for other things as part of your application.