'How create an endpoint for downloading a PDF and sharing the generation progress with Server-sent events
I have an endpoint which allow the user to download a PDF. As the PDF generation usually takes more than 20 seconds, I would like to send to the frontend information about the PDF generation progress while we are processing it. I had never used Server-sent events, but I did a simple test in Spring 4.3) and it works fine. But now I don't know how to use it for the PDF download.
Currently I'm writing the PDF in the response ("application/pdf"), but in this case I won't be able to return the object SseEmitter.
Do you have any suggestion for sending a progress stream to frontend and still being able to provide the PDF? Should I use websockets instead of SSE? Maybe two different endpoints? Any suggestion is welcome. :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
