You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jesper Sahner <je...@hotmail.com> on 2006/02/03 19:58:08 UTC

Basic http-question

Hi!

I have the following basic http-question.

When we use HttpClient we make a request and get a response. When looking 
for some specific information we may periodically make requests until the 
information is received.

My question is if it is possible - within the "http-framework" - to ask the 
server to return an answer when it has the answer instead of periodically 
asking for an answer which is basically waste of time.

If you have made a reservation for some article I guess you would ask the 
supplier to call you when he has the article for you instead of calling him 
every day.

By way of comparison how do Flash-driven websites which are dynamically 
updated (e.g. stock tickers) work in this context?


Regards,
Jesper



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Basic http-question

Posted by Bindul Bhowmik <bi...@gmail.com>.
On 2/4/06, Jesper Sahner <je...@hotmail.com> wrote:
>
> Hi Chris,
>
> Thanx for your answer.
>
>
> >From: Christopher L Merrill <ch...@webperformance.com>
> >Reply-To: "HttpClient User Discussion" <
> httpclient-user@jakarta.apache.org>
> >To: HttpClient User Discussion <ht...@jakarta.apache.org>
> >Subject: Re: Basic http-question
> >Date: Fri, 03 Feb 2006 15:26:01 -0500
> >
> >Jesper Sahner wrote:
> >>My question is if it is possible - within the "http-framework" - to ask
> >>the server to return an answer when it has the answer instead of
> >>periodically asking for an answer which is basically waste of time.
> >
> >HTTP is inherently a request/response protocol.  You could issue a
> >request and have server wait to respond until the desired data is
> >available.
> >But the socket would eventually timeout and you'd have to re-issue the
> >request.  Additionally, it needlessly ties up resources on the server.
> >
> I wonder how e.g. a mail-system like Hotmail works. If you are logged in
> you
> get a pop-up message every time a new message is received. Is that pop-up
> message the result of your request to the mail-server (guess not) or the
> mail-server just telling you that a new message is sent.


I am not a hotmail user, so can't help you with exactly how Hotmail works,
but we have built similar systems where we use JavaScript to poll the server
periodically to get the relevant updates and either reload the entire page
or just update the relevant sections of the document.

I wonder if something similar is possible with HTTP: You make an initial
> request telling the server to give you a notice every time a certain event
> occurs without making any further requests?
>
> A solution like this would be much more effective that repeatedly
> requesting
> for new events that hasn't occured.
>
> But as I read your answer, HTTP is a request/response protocol, so this is
> not possible.
>
> >>By way of comparison how do Flash-driven websites which are dynamically
> >>updated (e.g. stock tickers) work in this context?
> >
> >At least some of them are polling the server with requests every N
> seconds.
> >Some can open raw sockets to the server, but these methods have trouble
> >getting through firewalls.
> >
> >C
> >
> >--
> >-------------------------------------------------------------------------
> >Chris Merrill                  |  http://www.webperformance.com
> >Web Performance Inc.
> >
> >Website Load Testing and Stress Testing Software
> >-------------------------------------------------------------------------
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


_ Bindul

Re: Basic http-question

Posted by Jesper Sahner <je...@hotmail.com>.
Hi Chris,

Thanx for your answer.


>From: Christopher L Merrill <ch...@webperformance.com>
>Reply-To: "HttpClient User Discussion" <ht...@jakarta.apache.org>
>To: HttpClient User Discussion <ht...@jakarta.apache.org>
>Subject: Re: Basic http-question
>Date: Fri, 03 Feb 2006 15:26:01 -0500
>
>Jesper Sahner wrote:
>>My question is if it is possible - within the "http-framework" - to ask 
>>the server to return an answer when it has the answer instead of 
>>periodically asking for an answer which is basically waste of time.
>
>HTTP is inherently a request/response protocol.  You could issue a
>request and have server wait to respond until the desired data is 
>available.
>But the socket would eventually timeout and you'd have to re-issue the
>request.  Additionally, it needlessly ties up resources on the server.
>
I wonder how e.g. a mail-system like Hotmail works. If you are logged in you 
get a pop-up message every time a new message is received. Is that pop-up 
message the result of your request to the mail-server (guess not) or the 
mail-server just telling you that a new message is sent.

I wonder if something similar is possible with HTTP: You make an initial 
request telling the server to give you a notice every time a certain event 
occurs without making any further requests?

A solution like this would be much more effective that repeatedly requesting 
for new events that hasn't occured.

But as I read your answer, HTTP is a request/response protocol, so this is 
not possible.

>>By way of comparison how do Flash-driven websites which are dynamically 
>>updated (e.g. stock tickers) work in this context?
>
>At least some of them are polling the server with requests every N seconds.
>Some can open raw sockets to the server, but these methods have trouble
>getting through firewalls.
>
>C
>
>--
>-------------------------------------------------------------------------
>Chris Merrill                  |  http://www.webperformance.com
>Web Performance Inc.
>
>Website Load Testing and Stress Testing Software
>-------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Basic http-question

Posted by Christopher L Merrill <ch...@webperformance.com>.
Jesper Sahner wrote:
> My question is if it is possible - within the "http-framework" - to ask 
> the server to return an answer when it has the answer instead of 
> periodically asking for an answer which is basically waste of time.

HTTP is inherently a request/response protocol.  You could issue a
request and have server wait to respond until the desired data is available.
But the socket would eventually timeout and you'd have to re-issue the
request.  Additionally, it needlessly ties up resources on the server.

> By way of comparison how do Flash-driven websites which are dynamically 
> updated (e.g. stock tickers) work in this context?

At least some of them are polling the server with requests every N seconds.
Some can open raw sockets to the server, but these methods have trouble
getting through firewalls.

C

-- 
-------------------------------------------------------------------------
Chris Merrill                  |  http://www.webperformance.com
Web Performance Inc.

Website Load Testing and Stress Testing Software
-------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org