HTML and CSS Reference
Chapter 1. WebSocket - a Handshake!
In real life, handshaking is the act of gently grasping two people's hands, followed by
a brief up and down movement. If you have ever greeted someone this way, then you
already understand the basic concept of the HTML5 WebSocket protocol.
WebSockets define a persistent two-way communication between web servers and
web clients, meaning that both parties can exchange message data at the same time.
WebSockets introduce true concurrency, they are optimized for high performance,
and result in much more responsive and rich web applications.
The following diagram shows a server handshake with multiple clients:
For the record, the WebSocket protocol has been standardized by the Internet
Engineering Task Force ( IETF ) and the WebSocket API for web browsers is cur-
rently being standardized by the World Wide Web Consortium ( W3C )—yes, it's a
work in progress. No, you do not need to worry about enormous changes, as the cur-
rent specification has been published as "proposed standard".
Life before WebSocket
Before diving into the WebSockets' world, let's have a look at the existing techniques
used for bidirectional communication between servers and clients.