25.02.2013 Views

Peter Lubbers - Pro HTML 5 Programming

Pro HTML 5 Programming

Pro HTML 5 Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Download from Wow! eBook <br />

142<br />

CHAPTER 6 ■ USING THE <strong>HTML</strong>5 WEBSOCKET API<br />

Figure 6-2. A JavaScript stock ticker application<br />

It all looks great, but a look under the hood reveals there are some serious issues with this<br />

application. For example, in Mozilla Firefox with Firebug, you can see that GET requests hammer the<br />

server at one-second intervals. Turning on the Live HTTP Headers add-on reveals the shocking amount<br />

of header overhead that is associated with each request. Listings 6-3 and 6-4 show the HTTP header data<br />

for just a single request and response.<br />

Listing 6-3. HTTP request header<br />

GET /PollingStock//PollingStock HTTP/1.1<br />

Host: localhost:8080<br />

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102<br />

Firefox/3.5.5<br />

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<br />

Accept-Language: en-us<br />

Accept-Encoding: gzip,deflate<br />

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br />

Keep-Alive: 300<br />

Connection: keep-alive<br />

Referer: http://www.example.com/PollingStock/<br />

Cookie: showInheritedConstant=false; showInherited<strong>Pro</strong>tectedConstant=false;<br />

showInherited<strong>Pro</strong>perty=false; showInherited<strong>Pro</strong>tected<strong>Pro</strong>perty=false;<br />

showInheritedMethod=false; showInherited<strong>Pro</strong>tectedMethod=false;<br />

showInheritedEvent=false; showInheritedStyle=false; showInheritedEffect=false

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!