Chapter 10. WebSocket communications

This book has covered AJAX and web services, which provide a means to communicate to the server from the browser client. This chapter is about initiating communications from the browser to the server or from the server to the browser. If the server can send messages to the browser, the browser doesn’t need to poll the server for status information.

An example of two-way communications is a chat room application by which the server can notify many browsers that a message was received from a browser. Many games send data to a server, and the server controls data being sent back to the clients. Another example is when you initiate an asynchronous operation at the server, and the server provides status update messages ...

Get Training Guide: Programming in HTML5 with JavaScript and CSS3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.