Article From:https://segmentfault.com/q/1010000012148745
Question:

The batch push order join queue (laravel) is processed and completed after the queue is processed. Because it is asynchronous, how to change the status in real time to the page that triggers the push order (if all push is done to refresh the push page. Or give guidance to a state and so on.!!! Thank you

Answer 0:

Get to knowwebsocket,The ready – made workerman
Demo:
Receive message page: http://www.workerman.net:2123/
Push interface url:http://www.workerman.net:2121/? Type=publish& to=uid& content=content
Among them, to is the uid for receiving messages. If the space is empty, push content to all people for message content.

Answer 1:

phpIt is not a permanent memory language, and the interaction with the front end is not a long connection, although it can be done, but it can be done, but it is not recommended. Unless you want to push the background actively to the front end, it is bound to maintain such a long connection unless the specific use scene, and I suggest that you submit the push request at the current end and join the background.After the queue is processed, the front end starts the timing request background interface to determine the push state.

Answer 2:

Do websocket long connection in your order status page, bind the order number and websocket ID on the server side, then detect the long connection state dynamically, and push the state on the state.

Leave a Reply

Your email address will not be published. Required fields are marked *