200 likes | 665 Views
Netprog 2002 - Pull and Push. 2. Documents that change at regular intervals. Many possible applications:stock tickersweb based chatcollaborative applications. Netprog 2002 - Pull and Push. 3. Alternatives. Custom servers and clientsnot just web server and browserClient Pullbrowser asks the
E N D
1. Netprog 2002 - Pull and Push 1 Client Pull and Server Push Delivering Web content that changes over time.
2. Netprog 2002 - Pull and Push 2 Documents that change atregular intervals Many possible applications:
stock tickers
web based chat
collaborative applications
3. Netprog 2002 - Pull and Push 3 Alternatives Custom servers and clients
not just web server and browser
Client Pull
browser asks the server for new copy of the document at regular intervals
Server Push
server forces new versions of the document on the client at regular intervals.
4. Netprog 2002 - Pull and Push 4 Client Pull Browser knows that document should be refreshed after some time interval.
Each refresh is a new HTTP request.
HTML META tag supports this.
5. Netprog 2002 - Pull and Push 5 META Found in the HEAD of a document.
Supports a variety of functions:
define variables that are used by search engines.
author
page generator
set document expiration date.
include embedded objects (sounds).
6. Netprog 2002 - Pull and Push 6 <META HTTP-EQUIV= The HTTP-EQUIV attribute tells the Web Server to use the CONTENT attribute to generate HTTP response headers:
<META HTTP-EQUIV=“Expires”
CONTENT=“Tues, 29 Feb 2000
23:59:59 GMT”>
7. Netprog 2002 - Pull and Push 7 HTTP-EQUIV=“refresh” Tells the browser to automatically replace the document with another document.
automatic forwarding
client pull
8. Netprog 2002 - Pull and Push 8 Forwarding Example <META HTTP-EQUIV=“refresh”
CONTENT=“5;
URL=http://www.foo.com”>
9. Netprog 2002 - Pull and Push 9 Automatic RefreshExample <META HTTP-EQUIV=“refresh”
CONTENT=“5”>
With no URL specified, the same documented is reloaded.
10. Netprog 2002 - Pull and Push 10 Client Pull CGI creates a dynamic document set to automatically refresh.
CGI is run again (next request), this time the document may be different.
If replacement also contains refresh instructions, the client keeps refreshing forever…
11. Netprog 2002 - Pull and Push 11 Chat using Client Pull CGI program sends back a web page that includes refresh header.
web page also displays the latest stuff sent by others.
Client refreshes the page at regular intervals (or whenever user wants).
Will work, but potential for lots of unnecessary traffic, and response time is not so great…
12. Netprog 2002 - Pull and Push 12 Server Push Server does not send a complete document
the TCP connection stays open.
The client must be told to render the part of the response it has received.
The client must be told to replace the old part with new content.
13. Netprog 2002 - Pull and Push 13 Multipart Document The server tells the browser the document contains many parts.
browser gets the first part (and knows when it has the entire part).
server waits a while, then sends the next part.
The next part can be a multipart document as well…
14. Netprog 2002 - Pull and Push 14 MIME Multipurpose Internet Mail Extensions
used to specify “content type” on the WWW.
originally designed for sending things other than simple text in email messages.
Server tells the client what MIME type a document is (Content-Type).
Client must have a program that can understand this type (and render it).
15. Netprog 2002 - Pull and Push 15 Some MIME Types text/html
text/plain
application/postscript
image/gif
image/jpeg
audio/x-wav
application/zip
16. Netprog 2002 - Pull and Push 16 MIME Multipart multipart/mixed
Tells the browser the document type is a series of documents of mixed type
mixed type means each could be different type of document.
17. Netprog 2002 - Pull and Push 17 Document boundary* Content-type: multipart/mixed;boundary="1234567890"
--1234567890
Content-type: text/html
<H1>This is the first part</H1>
--1234567890
Content-type: text/html
<H1>This is the second part</H2>
--1234567890
18. Netprog 2002 - Pull and Push 18 x-mixed-replace Another MIME type:
x-mixed-replace
tells the browser to replace each part with the next one received.
Can have a CGI that generates multiple parts (with some delay in between parts).
This is server push.
19. Netprog 2002 - Pull and Push 19 Push based chat Server sends partial document.
Whenever server has new stuff to send the client, it basically replaces the entire document by sending a new part.
Server is in control of updates
TCP connection stays open the whole time.
20. Netprog 2002 - Pull and Push 20 Other approaches Applet creates connection to the server and can retrieve new messages, send new messages, etc.
Java (applet) programmer can decide whether to keep connection open (or even whether to use TCP or UDP).
Applet is responsible for drawing part of the web page.