Before HTML5 Web Sockets, web applications that needed to implement real-time updates, such as chat messages and game moves, had to resort to inefficient methods.
iframe element, also known as comet streaming
HTML5 WebSockets enable the exchange of real-time messages with the web server. The API is much cleaner and easier to use, less error-prone, and provides lower message latency.
In this recipe, we're going to implement a simple chat system based on WebSockets. To make the system easier to extend, we're going ...