This article mainly introduces the JavaScript data push Comet technology in detail. If you are interested, you can refer to the JavaScript data PUSH Service mainly for online webapp push, we don't need to take the initiative to push data from the Server to the local place every time we send Ajax requests like the Server.
History of Data push:
1. the HTTP protocol is simple round-robin, keeping a link unavailable, or sending requests to the backend through the front-end without stopping
2. After H5 is updated, WebSocket greatly improves the convenience of bidirectional and unidirectional data push.
3. SSE (Server-Send Event): a new way for the Server to push data
Comet: server push technology based on HTTP persistent connection
This lesson introduces Comet: server push technology based on HTTP persistent connection. Comet is a Web application architecture. The server actively pushes data (an endless loop of Ajax requests) to the client program asynchronously without explicitly sending requests from the client. The Comet architecture is very suitable for event-driven Web applications and applications that require strong interactivity and real-time performance, such as stock exchange analysis, chat rooms, and online Web games.
1. Let's take a look at the simplest example of ajax request json data:
Index.html