I have a request to update data in my server.
When i update i need to run a very heavy calculation that takes some time.
I want to do this:
1. Send request to update from client
2. Get the request in server and start a new thread to do the calculation, then update the object in my database and return a response to the client that the update is complete.
3. When the calculation ends - send another response to the client informing him that the calculation ended.
That way we have 2 appovals to the client.
In your routes you should have 2 entries :
(without context it's hard to give good names)
Then you define each one of those functions in your Controller,
Once you have this, you can call your API in your template, and you use the 2 responses
I use PlayFramework with Scala so sorry if I cannot help with chunks of code but I ran into problems similar to yours.
EDIT : After reading the question again I changed my approach