Reply to Re: Ajax asynchronous is it possible ?

Your name:

Reply:


Posted by Erwin Moller on 08/23/07 15:21

Jerry Stuckle wrote:
> Erwin Moller wrote:
>> Jerry Stuckle wrote:
>>> Piotr Nowak wrote:
>>>> Hi,
>>>>
>>>> Say i have a server process which listens for some changes in database.
>>>> When a change occurs i want to refresh my page in browser by
>>>> notyfinig it.
>>>>
>>>> I do not want to refresh my page i.e. every 5 seconds, i just want
>>>> to refresh it ONLY on server change just like desktop applications do.
>>>>
>>>> The problem is that refreshing evry n seconds has to much impact on
>>>> my web server. The refresh action should be taken only when
>>>> something really happens that makes sense
>>>>
>>>> Is it possible ?
>>>>
>>>> greets, peter
>>>
>>> Despite some other comments, no, it's not really possible with HTTP
>>> protocol. HTTP is a "request/response" protocol - the browser sends
>>> a request and the server responds. There really isn't a mechanism
>>> for sending unsolicited responses.
>>>
>>> As others have mentioned, it is possible to to with other means, i.e.
>>> Java or Flash. But not in PHP.
>>>
>>
>> Well, it IS possible with javascript and polling.
>> It stinks, depends on javascript, creates serverload, etc, but it IS
>> possible.
>> But I agree it has nothing to do with PHP. :-)
>>
>> Regards,
>> Erwin Moller
>
> Erwin,
>
> He said he wants to notify the browser, and he wants to do it without
> refreshing every few seconds. I take that to also mean polling.

Hi Jerry,

You are correct. I misinterpreted this line:
"I do not want to refresh my page i.e. every 5 seconds, i just want to
refresh it ONLY on server change just like desktop applications do."

That gave me the impression he wanted to poll using AJAX, instead of
refreshing the whole page. And then refresh the whole page if the
servers says ie is time to refresh.


>
> Even 1K players polling every 5 seconds would place a heck of a load on
> the server.

Yes. Serious drawback of polling like that.

>
> HTTP just isn't set up for this sort of thing.
>

True, but it can be misused for it.
Long ago I made a site do just that (before Ajax/xmlhttprequests) via
hidden frame refresh.
It sucked of course. ;-)

Java <--> JavaScript is a much cleaner solution.
But if memory serves me well the visitor had to give the applet rights
to listen to another port than 80.
I am kind of rusty with Java these days, so things might have changed.

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация