HTML and CSS Reference
Are Web Sockets a form of Comet? Or is Comet just the HTTP hacks? I'm gonna go for the latter definition.
The phrase and the hacks should probably ride off into the sunset together. I, for one, welcome our non-
HTTP realtime overlords. To the extent that we can forget about old browsers, we can all get on board
with “Web Sockets” and the need for any particular umbrella goes away.
The Solution: WebSockets
No doubt you've heard people talking about HTML5 and all its neat new features. Two of these new features directly
apply to realtime web technologies and client server communication—a fantastic result demonstrating that the web
standards organizations and browser vendors really do listen to our feedback.
Server-Sent Events and the EventSource API 13 are a formalization of the HTTP streaming solution but there is one
more solution that's even more exciting.
You may have heard the term WebSockets a time or two. If you've never really looked into realtime before,
WebSockets may not have shown up on your radar except as a buzzword in articles talking about all the great new
features of HTML5. The reason why WebSockets are so exciting is that they offer a standardized way of achieving
what we've been trying to do through Comet hacks for years. It means we can now achieve client server bidirectional
realtime communication over a single connection . It also comes with built-in support for communication to be made
Figure 1-5. Websockets open a full-duplex connection, allowing bidirectional client server communication
The WebSocket specification is part of HTML5, which means that web developers can use the WebSocket
protocol in modern browsers. 14