Reputation: 3714
I am sending file to my NodeJS Express based server by HTTP POST. After image is received by server, server starts processing. It takes few seconds and there is few steps in processing (Transform image, OCR, saving, etc).
I want to keep user informed while he waiting for server to process image with some responses ("Transforming image...","Converting...","Finishing...").
So I need some way to send data to user before actual end of processing and final response HTTP status and data.
Is this possible just by HTTP responses or I need to implement something different?
Upvotes: 2
Views: 40
Reputation: 1759
It is not possible for http to send two responses, you can build another api which the user can hit and get the status of the last request made, once you give an order to process the request, you can send the response as processing and a unique id using which the user can check the status (2nd api), and once the user hits another api to know the status, you can give him the current status as completed or in progress.
Upvotes: 1