Answer the question
In order to leave comments, you need to log in
Is it possible to send real-time messages to all visitors on the site using the Push and Pull module in Bitrix?
There was a need for each site visitor to see the update of information from the database in real time. Tell me how to do it, I use the Bitrix virtual machine
Answer the question
In order to leave comments, you need to log in
I can't say for a virtual machine. But I know how to do it manually.
You can write a simple JS script that will access the PHP script via AJAX every 2 seconds, for example, and the PHP script, in turn, will look at the database and display the necessary information.
I strongly do not recommend using a constant server poll. That every 2 seconds that once every 100 milliseconds.
This technique is called fast polling
. There is a much more competent solution, it is websocets or long polling. But not something else is better not to write in php. Since php is not suitable for this due to its single threading and high memory consumption. For implementation, you need to use the comet server , it is specially written for such tasks.
Or, to quickly get acquainted with the technology of comets, you can try SaaS comet service
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question