Monitoring Progress of a Web Request

I like this article for the purpose of conceptually understanding the architecture for monitoring the progress of an HTTP web request in a Browser:  https://buildwithdjango.com/blog/post/celery-progress-bars/

Regardless of technology, programming language, etc., it boils down to this:

  1. The initial HTTP request kicks off the work/job.
  2. Some infrastructure on the server-side starts the work in a background thread (or whatever) and returns the “work started” response.
  3. JavaScript / Ajax in the HTML running in the web browser periodically sends requests to get status information.
  4. Each Ajax status request must contain information that identifies the job.
  5. The server-side infrastructure has a means to locate the job and get information about it, such as percentage completed, or final results, and respond with this information back to the client.

There are many different ways to skin this cat — perhaps web sockets are used, or different server-side frameworks, etc. but in general it follows the above flow.

One slight alternative is Server Sent Events.  See https://www.w3schools.com/html/html5_serversentevents.asp

In the case of SSE, the initial request kicks off the job, but updates flow from the server to client automatically (but does the browser support SSE?).

Anyway.. this is just to give a person a general idea of what’s involved.