2

I'm currently trying to use a golang and echo app as both a web server and a reverse proxy and running into some issues.

The main goal of this app is to allow a client to download files of various sizes (kbs - gbs). The problem I've run into is that I need to be able to keep a running total of the bytes received by the clients so that if the file download is interrupted before the download is complete, the web server can send off a request to another microservice saying that an error occurred and only N bytes were received by the client.

Any ideas? I've already played around with some middlewares but haven't had much luck apart from using Static for files.

  • 1
    Why do you want to send to another microservice how many bytes were received by the client? What's the end result that you want? If it is that the client needs to be able to resume a download, then this step is not part of the solution. Just let the client decide where it wants to resume the download, the client knows for certain how much it has downloaded. – Erwin Bolwidt Oct 04 '22 at 00:43
  • Besides the resume - I'm sending the interrupt results to another service which makes a database call to write the error. So even if I port over the resume to the client - I'd still like to handle the interrupt server-side. – Colin Campbell Oct 04 '22 at 15:54

0 Answers0