在golang Webapp中处理发布请求时显示进度

On receiving the post request, the posted data passes through several functions and when the processing is done, it displays a suitable web page. The problem is that there is a bit of delay since the functions for processing data are somewhat time taking.

Is there a way I can show clients the progress of data processing? Essentially, when a data is posted, I want some messages to be dislayed like

Loading data (xyz conversion done)
Loading data (xyz added to stream)

I am using golang for my backend and julienschmidt's httprouter .

w ResponseWriter in your Handlers func(w ResponseWriter,r *Request) most likely implements http.Flusher interface. So you can

io.WriteString(w, "Loading data (xyz conversion done)")
w.(http.Flusher).Flush() //you must assert it implements
io.WriteString(w, payload)

flush to client before all work done. To take more control you even can hijack connection

conn, bufrw, err :=w.(http.Hijacker).Hijack()
defer conn.Close()
bufrw.WriteString("Loading data (xyz conversion done)")
bufrw.Flush()
bufrw.WriteString("Loading data (xyz added to stream)")
bufrw.Flush()

and speak raw TCP.

Showing a progress indicator is the job of your client-side code (while making an asynchronous call).

HTTP is a request–response protocol. Responses have a standard format (including a status line, headers, message body). They are not sent in parts.

What you are suggesting would be relevant to a TCP connection but not HTTP.