How to respond to the returned status of batch push orders in real time

batch push orders are queued (laravel). After queuing, processing is completed and returns a status. Because it is asynchronous, how to change the status back to the page that triggered the push order in real time (if all push is completed, refresh this push order page. Or give a status hint, etc.) ask for guidance! Thank you

Mar.24,2021

php is not a memory-resident language, and the interaction with the frontend is not a persistent connection. Although it is possible to do so, it is not recommended to do so, except for specific usage scenarios. In this case, you want the backend to actively push to the frontend, and it is necessary to maintain such a persistent connection. I recommend that when the frontend submits a push request and the backend joins the queue for processing, The front end starts to regularly request the background interface to determine the push status.


make a websocket persistent connection on your order status page, bind the order number to websocket id on the server, then check the persistent connection status dynamically, push if the status is maintained,


Websocket to do long connection, or ajax rotation training, but you can hold down the request during rotation training, waiting for the result or returning when the request expires quickly. This is the scheme adopted by Wechat on the web page.

Menu