The situation is as follows: after the front-end confirms the operation, the server initiates an ajax request to receive the request and start to execute the business logic cyclically. However, the server processes a large number of cyclic business logic, which takes a long time: how to return data to the client after each loop to let the user know the current progress
The situation is as follows:
After the front-end confirms the operation, initiate an ajax request
When the server receives the request, it starts to execute the business logic cyclically. However, the process involves a large amount of cyclic business logic and takes a long time.
Problem:
How to return data to the client after each loop,Let the user know the current progress
Reply content:
The situation is as follows:
After the front-end confirms the operation, initiate an ajax request
When the server receives the request, it starts to execute the business logic cyclically. However, the process involves a large amount of cyclic business logic and takes a long time.
Problem:
How to return data to the client after each loop,Let the user know the current progress
Common ajax and http cannot meet this requirement, which can be achieved through websocket. PHP is a mature swoole framework.
Push with websocket
The first two have already saidWebsocket.
Then I will fill in anotherServer sent events, AbbreviationSSE.
Your server can send data to the client in one way.