Comet
lastmod 2018-08-17created 2014-05-1210 edits
Due to the nature of the Http protocol, a persistent connection is not possible. So when the client connects, the server sends a response and the connection is closed. In some cases, however, a persistent connection is needed.
comet is also called Reverser Ajax or Ajax Push. Rather than the name of a specific technology, it is a term for push methods over HTTP.
How Comet is implemented
- Polling (Ajax)
- Sends requests to the server at regular intervals to receive server events. Shortening the request interval lets you receive server events almost in real time. However, it consumes a lot of server resources, so it is hard to use this way in practice.
- Long Polling (Comet)
- When the client connects to the server, the server keeps the connection open, and when an event occurs it sends it to the client and ends the HTTP transaction. When the client receives the message, it connects to the server again.
- Streaming (Comet)
- Keeps the connection between client and server open and sends data using HTTP Chunked encoding whenever an event occurs on the server. Because of some limitations, however, Long Polling is usually used instead.
See also
Favorite site
- Wikipedia (en) article on Comet
- The concept of Comet
- LONG POLLING/COMET/PUSH SERVER
- [Recommended] Asynchronous HTTP and Comet architectures
- Implementing Long Polling in the Play framework
- HTML5 SERVER-SENT EVENTS 1
- About Comet
References
-
Html5-server_send_event.pdf ↩