Introduced in
Netscape 1.1,
server push is a method of creating
dynamic web applications that predates
JavaScript and
DHTML. Server push allows a web server to keep an
HTTP connection to a
browser open, and refresh the web page at it's discretion. The server can push new pages to the browser whenever appropriate. It is surprisingly powerful; it can be used for dynamically updating web pages without constantly
polling a server, to provide incremental results for long operations, and to show live data that reflects changes by other users of the system. Entire
IRC clients have been built using only
server push and
HTML form submission.
The Achilles Heel of server push is standardization -- though it draws upon the HTTP and MIME standards, it's itself a proprietary Netscape extension. Worse yet, it is one that Microsoft has not felt useful enough to implement in its Internet Explorer browser.
Server push is implemented by having the server return an HTTP response with a Content-type of multipart/x-mixed-replace. The pages must be MIME encoded, much like an e-mail with attachments. Here is a simple example dialogue, where the browser would first display "First Page", then "Second Page":
Browser: GET /dynamicdoc HTTP/1.1
Browser: Host: somehost
Browser:
Server: HTTP/1.1 200 OK
Server: Content-Type: multipart/x-mixed-replace;boundary=--Boundary-----c1398847ccc668c2
Server:
Server: ----Boundary-----c1398847ccc668c2
Server: Content-Type: text/html
Server:
Server: <html>First Page</html>
Server:
Server: ----Boundary-----c1398847ccc668c2
Server: Content-Type: text/html
Server:
Server: <html>Second Page</html>
Server:
Server: ----Boundary-----c1398847ccc668c2--