forcing an http request to sleep/delay

R

Robert Huie

Hi all,

I'm trying to use asp.net to code a chat window and I would like to make the
http request delay as long as possible till the process/thread detects a new
incoming message.

basically something like the following:

while(nonewmessages) {
nonewmessages = checkfornewmessages();
delay(100);
}

I haven't found a delay function nor does thread.sleep works.

I understand that coding a meta tag refresh rate can resolve the problem in
a "pull" like fashion but I would like to "push" the data on the fly through
displaying existing chat messages and then holding the http request
connection until next message arrives. At that point a refresh can be made
and thus saving unnecessary amounts of requests being made to the server.

Thanks for any input into this matter.

Robert Huie
 
S

Scott Mitchell [MVP]

Robert said:
I understand that coding a meta tag refresh rate can resolve the problem in
a "pull" like fashion but I would like to "push" the data on the fly through
displaying existing chat messages and then holding the http request
connection until next message arrives. At that point a refresh can be made
and thus saving unnecessary amounts of requests being made to the server.

Robert, HTTP is structured as a request/response protocol, with the
client initiating a request, and the server sending a response. The
point being, I think you're not going to be able to do what you want
without using a Java applet or something like that - an actual program
that establishes a peer-to-peer connection between the client and
server. Point being, HTTP is not designed to accomplish what you're after.

Now, there are some "workarounds" that can give the end user the
perception that the screen is only updating when needed. For example,
you could have a hidden frame that checks back periodically, and if
there are new messages, then it refreshes the main window...

Hope this helps.

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top