HTML and CSS Reference
its clients and does not require any interactivity (such as newsfeeds, weather forecasts,
and so on), then using the EventSource API provided by Server-Sent Events (SSE) is
a good option. SSE, which is part of the HTML5 specification, consolidates some Comet
techniques. It is possible to use SSE as a common, interoperable syntax for HTTP polling,
long polling, and streaming. With SSE, you get auto-reconnect, event IDs, and so on.
■ Although WebSocket and SSE connections both begin with HTTP requests, the
performance benefits you see and their abilities might be quite different. For example,
SSE cannot send streaming data upstream from the client to the server and supports only
SPDY (pronounced “speedy”) is a networking protocol being developed by Google,
and is supported by a growing number of browsers, including Google Chrome, Opera,
and Mozilla Firefox. In essence, SPDY augments HTTP to improve the performance of
HTTP requests by doing things like compressing HTTP headers and multiplexing. Its
main purpose is to improve the performance of web pages . While WebSocket is focused
on optimizing communication between web application front-ends and servers, SPDY
optimizes delivery application content and static pages, as well. The differences between
HTTP and WebSocket are architectural, not incremental. SPDY is a revised form of HTTP,
so it shares the same architectural style and semantics. It fixes many of the non-intrinsic
problems with HTTP, adding multiplexing, working pipelining, and other useful
enhancements. WebSocket removes request-response style communication and enables
real-time interaction and alternative architectural patterns.
WebSocket and SPDY are complementary; you will be able to upgrade your
SPDY-augmented HTTP connection to WebSocket, thus using WebSocket over SPDY
and benefitting from the best of both worlds.
Web Real-Time Communication
Web Real-Time Communication (WebRTC) is another effort to enhance the
communication capabilities of modern web browsers. WebRTC is peer-to-peer technology
for the Web. Browsers can communicate directly without funneling all of the data through
a server. WebRTC includes APIs that let browsers communicate with each other in real
time. At the time of writing this topic, the WebRTC is still in draft format by the World Wide
The first applications for WebRTC are real-time voice and video chat. WebRTC
is already a compelling new technology for media applications, and there are many
available sample applications online that enable you to test this out with video and audio
over the Web.
WebRTC will later add data channels. These data channels are planned to use similar
API as WebSocket for consistency. Additionally, if your application makes use of
streaming media and other data, you can use both WebSocket and WebRTC together.