Book Image

Getting Started with HTML5 WebSocket Programming

By : Vangos Pterneas
Book Image

Getting Started with HTML5 WebSocket Programming

By: Vangos Pterneas

Overview of this book

<p>WebSockets are capable of bi-directional, full-duplex communication over a persistent TCP connection They provide many benefits compared to the alternatives (for example, long-polling or Comet), such as lower overhead, persistent connections, and low latency. In short, it is the most technically challenging HTML5 feature to implement, but for truly interactive websites, it's a technology worth learning.</p> <p>Getting Started with HTML5 WebSocket Programming gives you the true power of bi-directional communication, implemented by using the brand new HTML5 WebSocket API. You’ll learn how to configure the server and clients, how to transmit different types of data and how to secure the whole system.</p> <p>This book will introduce you to the WebSocket world. We start by introducing the WebSocket API, and continue with practical, real-world examples until we can determine how to build multi-functional web apps for any type of device.</p> <p>You will learn how to configure a web client and a web server that will help you send messages to others using easy-to-use mechanisms. We will also find out how different data types, such as images and videos, can be transferred with little effort. We present additional fallback techniques and solutions for older browsers too. Finally, we will secure our clients from malicious attacks and other threats.</p>
Table of Contents (15 chapters)

Then came HTML5


HTML5 makes a huge, yet justifiable, buzz nowadays as it introduces vital solutions to the problems discussed previously. If you are already familiar with HTML5, feel free to skip this section and move on.

HTML5 is a robust framework for developing and designing web applications.

HTML5 is not just a new markup or some new styling selectors, neither is it a new programming language. HTML5 stands for a collection of technologies, programming languages and tools, each of which has a discrete role and all of these together accomplish a specific task—that is, to build rich web apps for any kind of device.

The main HTML5 pillars include Markup, CSS3, and JavaScript APIs, together.

The following diagram shows HTML5 components:

Here are the dominant members of the HTML5 family. As this book does not cover the whole set of HTML5, I suggest you visit html5rocks.com and get started with hands-on examples and demos.

Markup

Structural elements

Form elements

Attributes

Graphics

Style sheets

Canvas

SVG

WebGL

Multimedia

Audio

Video

Storage

Cache

Local storage

Web SQL

Connectivity

WebMessaging

WebSocket

WebWorkers

Location

Geolocation

Although Storage and Connectivity are supposed to be the most advanced topics, you do not need to worry if you are not an experienced web developer. Throughout this book, we will explain how to accomplish common tasks and we'll create some step-by-step examples, which you can later download and experiment with. Moreover, managing WebSockets via the HTML5 API is pretty simple to grasp, so take a deep breath and dive in with no fear.