Server push is a technology that allows the server to send data back to the client without forcing the client to make many requests (for example, every 7 seconds). This is actually not a javascript issue, but a good server-side scripting. The upcoming HTML5 will simplify the use of events sent by the server and / or WebSockets . This will be a true TCP connection between different machines.
But if you intend to make the web page compatible with older browsers, then the most common method is a lengthy survey. The client sends a request to the server, and the server does not respond to it until it receives new data. If so, then the answer is made, and the client immediately after receiving the data calls the server with a new request. In practice, however, this requires the server to be well-written (for example, it must support thousands of downtime at the same time) and can be quite a challenge for developers.
Hope this helps. :) Good luck!
source share