It looks like you will need a COMET / Push solution that allows you to track active clients and push new data on them. I'm not sure if PHP is the best solution for this, as there are other programming languages ββthat handle this more elegantly.
See: Using comet with PHP?
Others may disagree, but Node.js is a great and appropriate solution for this particular problem. Combine Node.js with Socket.io , and you have the basic tools to implement exactly what you are describing.
In short, the client application will send an AJAX request to the server. Then the server will hold the request until it has something to return (in your case, the timer is running, the timer is ticked, the timer is paused, etc.). As soon as the data is returned, another request will be made and held by the server, thereby repeating this process. If your server and client support WebSockets , then you can hold AJAX connections in favor of a WebSocket connection (TCP over HTTP).
Since not everyone uses the latest version of Chrome / Firefox, you may have to support several push methods in order to be browser compatible. Socket.io reviews the communication layer (Comet - long-term survey, WebSockets, Adobe Flash Socket, multi-user streaming Ajax, Forever Iframe, JSONP Polling) and selects the best technology based on the capabilities of the client browser.
Alternative
You can also use the javascript interval to periodically poll the server (via AJAX) to see if a timer is set. However, you can load the server with requests, as each client will constantly poll the server to determine if the 60-second timer has started.
source share