On 31/07/2007, at 8:44 AM, Kevin Scaldeferri wrote:
The system I'm working on has a number of page requests which can
take a long time to return the results to the user. Not to
surprisingly, the users don't like looking at a blank page for
30-60 seconds before the reply comes back and finally renders. I'm
wondering what techniques other people use for dealing with this
sort of thing, and if there are POE components to help out with it.
One approach would be to return a placeholder page that says
"working on your request <spinner>" that periodically refreshes
until the request is done. I know how to do this using a unique
request identifier in the URL, but I'm not sure how to make this
play well with bookmarking or emailing URLs to other people.
I could also just send some header HTML out right away, then wait
until everything else is ready to send the rest of the page, but
this approach seems counter to how most of the templating systems
want to work. Is there some straightforward way to combine HTML
templating and partial page loading? Of course, this approach
still leaves the user sitting looking at an unchanging page for
quite a while.
My ideal UI would be some sort of AJAXy UI with status messages
being replaced with results as they come in, but since I basically
know nothing about how to implement that sort of thing, and I'd
need to substantially re-engineer my application to do it, I'm
hoping to find some sort of acceptable partial solution that will
work while I learn how to do what I really want.
Kevin,
You haven't really detailed anything about what you're doing. Are you
using a web-framework? which HTTP server? what are you using POE for?
etc.
From your basic overview I would be assigning a unique ID to a task
(possibly associated with a specific user's session if you desire)
and including that in the query parameters ( http://server/page?
taskid=12345 ) and have your page return a 'refresh' header and some
pretty waiting message until the task is complete. This means your UI
will be constantly pulling information from the backend, saying "is
it ready yet?".
On the other hand, your 'ideal UI' would involve pushing events from
the POE application server to the client UI, instead of having the UI
pull results from the backend. This is the sort of thing being done
on the Cometd project so you may wish to have a look around there
( http://www.cometd.com ). There's lots of collaboration between the
Cometd, POE and Catalyst projects so you shouldn't have a hard time
integrating something like this.
Regards,
Tom