Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
In HTML5 First Look, author James Williamson introduces the newest HTML specification, providing a high-level overview of HTML5 in its current state, how it differs from HTML 4, the current level of support in various browsers and mobile devices, and how the specification might evolve in the future. Exercise files accompany the course.
Another specification that was originally part of the HTML5 specification and then split off later is the WebSocket API. Describing what the WebSocket API is, is rather difficult without first discussing how clients and servers have communicated in the past. At first, the web was stateless. The client would send a request to the server; the server would process it and then send back the requested information. Now, usually that would refresh the page. Now, much of the web still works this way today.
Over time more sophisticated means of sending data back and forth to the server evolved. AJAX applications are able to send data asynchronously, retrieving the data from a server without requiring a page refresh. Now, Comet is a term that's used to describe the technique of sending data from the server without necessarily requiring a request from the browser. Both of these techniques allow developers to create much more dynamic, responsive and user-friendly applications. At their core however, they both have problems.
In the end these techniques still require the client to initiate the request. If data changes on the server, there is no way for the client to know or even respond to this. Comet applications get around this by something called long polling, where the Browser sends a request to the server and the server keeps that request open for a set amount of time. As you could imagine these techniques can put a large amount of strain on the server and forces the server to keep track of these polling requests. What's more, the techniques required for AJAX and Comet applications to deal with firewalls and proxy servers can be mind-numbingly complex.
Well, this is where WebSockets come in. The WebSocket API is designed to create a single bidirectional connection between the client and server. Unlike AJAX or Comet solutions WebSockets are designed to be native to the Browser making them lightweight and easy to implement. Perhaps more importantly, WebSockets use their own protocol, allowing them to tunnel through firewalls and proxies with no additional effort. WebSockets work by opening up an HTTP connection to the server and then negotiating a persistent WebSocket connection using either the WebSocket or secure WebSocket protocol.
Now, you can see here how simple the syntax is for establishing a WebSocket connection. Once the connection is established there are methods available to control sending the data and monitoring the connection. The use of WebSockets will provide immediate benefits for web applications. First, since firewalls and proxies are no longer problematic streaming is now possible through any connection. Since the connections are bidirectional, separate connections for upstream and downstream communications aren't necessary.
I recommend keeping a close eye on the development of WebSockets and how their adoption will change the web.
There are currently no FAQs about HTML5 First Look.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.