0

I am implementing a system that checks the plagiarism of documents.

our stack is vuejs, nodejs/express and flask for python.

My question is that i have a page which the user will upload his documents for checking and the vue ui will send a request to the backend apis with the user file to check the similarity, while this process is running a loading overlay is displayed in the same page.

I want to update this page with live steps from the backend side like "extracting", "searching", "comparing", "generating report".

noting that the request sent with the user file have only one response.

so any ideas how can i achieve this step ??

Thanks ,,

N05h3ll
  • 25
  • 6
  • Websockets, polling, or server-sent events: https://www.html5rocks.com/en/tutorials/eventsource/basics/, https://stackoverflow.com/questions/135478/how-do-you-measure-the-progress-of-a-web-service-call, https://stackoverflow.com/questions/24608335/jquery-progress-bar-server-side – Zac Anger Jan 25 '21 at 00:07

2 Answers2

1

Websockets, polling, or server-sent events (SSEs) would all work for this. There are libraries for working with SSEs for client and server including Flask and Node, and it can also be done without extra libraries (for example, in Flask and Express).

Zac Anger
  • 6,983
  • 2
  • 15
  • 42
0

You can return a request_id and after that you can use the id to check on the status/stage of the request.

Ash
  • 73
  • 1
  • 8
  • How and where to save the request id, the http request have one response, so how to return a state and then check for the status. – N05h3ll Jan 25 '21 at 00:45
  • How and where to save it depends on how you implement the frontend. The basic approach is that when you submit the document, the backend responses with a request_id. The backend should have another service exposed which lets you check on the status/process of the document using the request_id. That's the idea of it, and a simple way to do it, but won't be able to tell you how to implement it as that depends on how your program has been written. Also do check out the links provided by Zac under your question. – Ash Jan 25 '21 at 00:49
  • yes i did my research about server-sent events as zac said and i found it is the best solution for what i need. – N05h3ll Jan 25 '21 at 02:10