Send updates about the state of a running HTTP request to the client

I would like to send updates of a running HTTP request to the client to tell it at what stage the request-triggered process currently is.

The process behind the request does currently the following things (in this order):

Client-side:

  • Client sends an HTTP Request (upload of a file) to the server

Server-side:

  • Takes the uploaded file
  • Encrypt it
  • Upload it to an archive storage
  • Return response to the client (Meanwhile, the client does not know what currently happens)

Client-side:

  • Get response and show it to the user

I want to tell the client at what stage the process is, like “Uploading done. Encrypting…” and so on.

Is there a way to realize that, or am I missing something? Is it even possible to do?

Frameworks I'm using:

  • Client: Next.js
  • Server: Hapi.dev for API development

Thanks

1 answer

  • answered 2022-05-04 10:37 finn

    You can send non-final 1xx header responses for your http request as described here.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum