Re: [PHP] server sending notifications to clients

2006-06-09 Thread Richard Lynch
On Thu, June 8, 2006 9:24 am, kartikay malhotra wrote:
 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?

Keep a table of notifications and what time they happened, and if
the user has seen them -- perhaps even allowing the user to choose
which ones to dismiss, perhaps even only having a little icon about
notifications if there are any...

When the users hits a page, check the notifications table for things
they ought to know about.

The exact rules of how/when to do what is up to you and your users,
but give it a lot of thought before you go annoying the [bleep] out of
users with a damn popup for each notification stacked up or
something... :-)

This takes a lot more thought about WHAT to do from a
process/user-interface side than HOW to code it in PHP.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] server sending notifications to clients

2006-06-08 Thread kartikay malhotra

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?

Thanks
KM


Re: [PHP] server sending notifications to clients

2006-06-08 Thread Brad Bonkoski



kartikay malhotra wrote:


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?


Don't think it can
But you can have the client (think AJAX) continuously 'poll' the server, 
and then the server can send updates back if necessary.

-Brad


Thanks
KM



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] server sending notifications to clients

2006-06-08 Thread Angelo Zanetti

kartikay malhotra wrote:

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?

Thanks
KM




what kind of event??

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] server sending notifications to clients

2006-06-08 Thread Jay Blanchard
[snip]
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?
[/snip]

You would need a connection with state to do that, web server
connections are stateless. The client would have to have a 'listener'
waiting for some event to be pushed to them and then the listener would
take an action.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] server sending notifications to clients

2006-06-08 Thread Jim Moseby
 
 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] server sending notifications to clients

2006-06-08 Thread Barry

Angelo Zanetti schrieb:

kartikay malhotra wrote:

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?

Thanks
KM




what kind of event??


Server bored and fooling around with the neighbor servers hardware :P

But Ajax would be the best method using.

Anyway else isn't possible (well refreshing would be one way)

But since you don't want php files to execute forever you will have to 
stick to AJAX.


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] server sending notifications to clients

2006-06-08 Thread Adam Zey

Barry wrote:

Angelo Zanetti schrieb:

kartikay malhotra wrote:

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?

Thanks
KM




what kind of event??


Server bored and fooling around with the neighbor servers hardware :P

But Ajax would be the best method using.

Anyway else isn't possible (well refreshing would be one way)

But since you don't want php files to execute forever you will have to 
stick to AJAX.




You can do it without polling. I've seen web applications that open a 
neverending GET request in order to get updates to the browser 
instantaneously.


Regards, Adam.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] server sending notifications to clients

2006-06-08 Thread kartikay malhotra

Dear Adam,


You can do it without polling. I've seen web applications that open a
neverending GET request in order to get updates to the browser
instantaneously.

Regards, Adam.

Kindly elaborate on neverending GET request. Shall I call the script from
within itself?

Regards
KM

On 6/8/06, Adam Zey [EMAIL PROTECTED] wrote:


Barry wrote:
 Angelo Zanetti schrieb:
 kartikay malhotra wrote:
 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?

 Thanks
 KM



 what kind of event??

 Server bored and fooling around with the neighbor servers hardware :P

 But Ajax would be the best method using.

 Anyway else isn't possible (well refreshing would be one way)

 But since you don't want php files to execute forever you will have to
 stick to AJAX.


You can do it without polling. I've seen web applications that open a
neverending GET request in order to get updates to the browser
instantaneously.

Regards, Adam.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] server sending notifications to clients

2006-06-08 Thread Adam Zey

kartikay malhotra wrote:

Dear Adam,


You can do it without polling. I've seen web applications that open a
neverending GET request in order to get updates to the browser
instantaneously.

Regards, Adam.

Kindly elaborate on neverending GET request. Shall I call the script from
within itself?

Regards
KM

On 6/8/06, Adam Zey [EMAIL PROTECTED] wrote:


Barry wrote:
 Angelo Zanetti schrieb:
 kartikay malhotra wrote:
 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?

 Thanks
 KM



 what kind of event??

 Server bored and fooling around with the neighbor servers hardware :P

 But Ajax would be the best method using.

 Anyway else isn't possible (well refreshing would be one way)

 But since you don't want php files to execute forever you will have to
 stick to AJAX.


You can do it without polling. I've seen web applications that open a
neverending GET request in order to get updates to the browser
instantaneously.

Regards, Adam.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






I refer to having the javascript code open a GET request that never ends 
and streaming data from the server back to the client. The server-side 
PHP process, which stays running, streams back data whenever it becomes 
available. This of course uses a lot of memory. I have never done this 
myself in a web application, so I suggest you google for examples of 
other people who have actually implemented it.


Regards, Adam Zey.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php