Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In normal HTTP networking with XHR or the <script> tag, the client requests or
“pulls” data from the server when it needs it. There is another style of
HTTP-based networking that is used by some web applications. In “server
push” or “comet,” the client and server establish an HTTP connection, but
leave it open indefinitely, which allows the server to push data to the
client through that open connection.
It is possible but difficult to implement this style of networking
with XHR, but a new HTML5-related standard known as Server-Sent Events
defines a simple EventSource API that makes it trivial to receive and
respond to messages pushed by the server. To use Server-Sent Events,
simply pass a URL to the EventSource() constructor and then listen for message events on
the returned object: