progress messages from server

R

Roedy Green

A customer of mine has asked how you best arrange for progress
messages from a server for something that takes a long time to
complete if you use plain HTTP.

Do you just keep sending HTTP packets back to repaint one HTML frame,
or is there something more to it?

We was going to have me write some client side code to manage it, but
he wanted this to work also in very old machines without decent Java,
so I though the thin approach might work better.

Is there a tutorial that explains the HTTP protocol on such matters?

Likely the server side will NOT be Java.
 
B

bm

Either you are going to poll the server every so often to find if the job
is done that means you have to implement presistent sessions using
cookies or session ids. This is not a good approach. Every client-server
book would tell you not to poll the server.

Or, have the server to keep a presistent session, same as the other choice,
and update the status by sending the client http messages which means you
have to do multi-threading on the server code. So much coding and change
for such a small feature. Not worth the effort.

Or, make your life easier. There are too many unknown variables here to now
how long each operation would take. How are you going to make a progress
bar anyway? Unless you set the progress based on the number of tasks that
need
to be accomplished to finish the job. So either partition the job and send
each
task to the server separately and show the progress that way in the client.
Or
if there is only one task to do, then have a simple flashing text saying
'Please wait for such and such task to complete. This operation
may take so and so much time. Please be patient. If the
operation takes a long time, click the link below
http://..... '
Simple, easy and elegent.

hope this saves you a lot of grief.
 
R

Roedy Green

Or, make your life easier. There are too many unknown variables here to now
how long each operation would take. How are you going to make a progress
bar anyway? Unless you set the progress based on the number of tasks that
need
to be accomplished to finish the job. So either partition the job and send
each
task to the server separately and show the progress that way in the client.

The progress is a series of status messages.
 
B

bm

If you want the business logic strictly in the server, then do the
tasks in the server and send a status message in HTML to the
client after completing each individual task. A servlet with
session enabled would do the trick.

Otherwise, put the logic in the client using multiple calls to the
server. I think this approach would be more complicated. You
have to think about synchronizing session and transaction logic
between server and client.
 
M

Michael Borgwardt

Roedy said:
A customer of mine has asked how you best arrange for progress
messages from a server for something that takes a long time to
complete if you use plain HTTP.

Do you just keep sending HTTP packets back to repaint one HTML frame,
or is there something more to it?

It's a bit of a hack, but it should work: keep one HTTP connection
for a page that's not visible (e.g. to a 0x0 pixel frame)
open all the time by steadily sending a little data through it so that
it does not time out. When you want to display a status message,
send a javascript command that updates another frame.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top