How to send push request from server to client in springboot?

Goku Africa :

So I have a restful service which is called by a client. Unfortunately the service is calculation intensive and hence the response goes back to the client after a long time. Is there any way where I can send some dummy response to the client immediately and then later when the calculations are done send the actual data from the server to the client in the form of a server to client request?

User9123 :
  1. via @Async method run your calculation in new thread

  2. while your calculation is running you can send dummy response for your client (you can also add request_id to response for short-polling)

  3. later use short-polling or WebSocket to notify your clients

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=17389&siteId=1