RE: [PHP] server sending notifications to clients

From: Date: Thu, 08 Jun 2006 14:29:32 +0000
Subject: RE: [PHP] server sending notifications to clients
Groups: php.general 
Request: Send a blank email to php-general+get-237619@lists.php.net to get a copy of this message
> > Hi All, > > Is there a way for the server to notify the client about an > event, provided > the client was online in the past X minutes? > > To elaborate: > > A client comes online. A script PHP executes (serves the client), and > terminates. Now if a new event occurs, how can the server > notify the client > about that event? > Short answer: It can't. Longer answer: There are probably 100 ways to get close to the result you are looking for. For instance, you could have each page on your site look for a flag in a DB, or a file in the filesystem, or some other clue. Then when the user loads a new page, the page discovers the event, and notifies him. PHP is server side. So everything it generates, it does so on page load. There are PHP/Javascript solutions (like AJAX) that may be able to get closer to what you want. We would need more detail for a more detailed answer. JM

« previous php.general (#237619) next »