How do I implement ajax progress in TIdHTTPServer?

I have a service project that provides a HTTP server via TIdHTTPServer, and a web frontend. A number of functions that the user may initiate can take 5-10 seconds to complete, during which time they only see a gif animation while the ajax request waits for my delphi code to complete and return a status.

I'd like to implement a progress bar, or percentage (perhaps estimated time remaining, etc), but I'm not sure how it should be implemented. XMLHTTPRequest() has a progress event, which seems easy enough to implement on the client, but how do I have the server respond with it's progress?




Another way to deal with long XMLHttpRequest Calls is to explicitly introduce a second monitoring channel. While the primary request takes place, a sequence of monitoring requests are issued to ask the server for a progress estimates. For example, the server might be looping through 1000 records, running a transformation on each of those and saving it to the database. The loop variable can be exposed so that a monitoring service can convert it into a percentage remaining figure.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.