The technology / technology you are looking for is called Server Push.
The main idea: the client should respond to some events occurring on the server.
Possible solutions:
- Polling some server actions through AJAX in a timely manner;
- Saving a long-term AJAX request on the server side until a timeout or event occurs, and then process the result on the client (determine if this was a server action or just a timeout), if necessary, reconnect to the client.
and several other solutions, which are mainly variations of the two above. Also, the solution will depend heavily on the server-side technology you use.
Google has a short but very informative article on what this technique is and how it can be implemented here . He is an (almost) technological agnostic, so he should help you understand the concepts and possible solutions.
source share