HTML and CSS Reference
WebSocket is about Performance
WebSocket makes real-time communication much more efficient.
You can always use polling (and sometimes even streaming) over HTTP to receive
notifications over HTTP. However, WebSocket saves bandwidth, CPU power, and latency.
WebSocket is an innovation in performance.
WebSocket is about Simplicity
WebSocket makes communication between a client and server over the Web much
Those who have already gone through the headache of establishing real-time
communication in pre-WebSocket architectures know that techniques for real-time
notification over HTTP are overly complicated. Maintaining session state across stateless
requests adds complexity. Cross-origin AJAX is convoluted, processing ordered requests
with AJAX requires special consideration, and communicating with AJAX is complicated.
Every attempt to stretch HTTP into use cases for which it was not designed increases
WebSocket enables you to dramatically simplify connection-oriented
communication in real-time applications.
WebSocket is about Standards
WebSocket is an underlying network protocol that enables you to build other standard
protocols on top of it.
Many web applications are essentially monolithic. Most AJAX applications typically
consist of tightly coupled client and server components. Because WebSocket naturally
supports the concept of higher-level application protocols, you can more flexibly evolve
clients and servers independently of one another. Supporting these higher-level protocols
enables modularity and encourages the development of reusable components. For
example, you can use the same XMPP over WebSocket client to sign in to different chat
servers because all XMPP servers understand the same standard protocol.
WebSocket is an innovation in interoperable web applications.
WebSocket is about HTML5
WebSocket is part of an effort to provide advanced capabilities to HTML5 applications in
order to compete with other platforms.
Every operating system needs networking capabilities. The ability for applications to
open sockets and communicate with other hosts is a core feature provided by every major
platform. HTML5 is, in many ways, a trend toward making web browsers fully capable
application platforms that are analogous to operating systems. Low-level networking APIs
like sockets would not mesh with the origin security model or API design style of the Web.
WebSocket provides TCP-style networking for HTML5 applications without wrecking
browser security and it has a modern API.
WebSocket is a key component of the HTML5 platform and an incredibly powerful
tool for developers.