I'm using spring boot to create a restful backend application and the frontend is using vue. When someone sends a rest request to my backend application via my frontend webpage, is it possible to stop the backend processing thread after the webpage or the web browser is closed?
HTTP Request cannot be cancelled. General guideline is, the REST calls should be very short. If in case, your REST calls are long running, recommendation is to break into granular calls.
If that is not an option and if you want to cancel a back-end processing, following option can be tried
For every back-end call, return a job id using which server can uniquely identify and return it to the client
Detect browser close
This will require considerable amount of change!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With