Hello . I rummaged through the entire Internet and did not find anything. In general, there is an admin for an online store on yii-2, where there is a page with orders. You need to make sure that when you add a new order to the database, the div with orders is automatically updated. I read about comet, long-polling, web sockets, but in their examples, as a rule, only different chats were made. What to apply in my case? What technologies to use? thanks for answers .
2 answers
websocket - for sure, for older browsers there is a flash implementation option. ease of implementation, minimal server load. only pluses, minuses not ... I speak from a decent practice of application
- write to php? - Kolya Vantukh
- no, on java. What is the question? - Vadim
- Interestingly just some implementation details on php - Kolya Vantukh
- @KolyaVantukh, I can recommend my implementation features. how to implement this on the server side of php - I can not say, but on the browser side, everything is the same for any server. works great and versatile. - Vadim
- I will be very grateful - Kolya Vantukh
|
ajax, like a lazy option.
We write a script for the server that checks the database for new orders. You can simply take data from the database, where the add time> = the current time is 5 minutes, and if you have such data, return it in the finished markup, if not, return false.
We write javascript, polling the above-mentioned server script every 5-15 seconds for new orders and, if they are, change div.
|