Free Sample
+ Collection

Getting Started with HTML5 WebSocket Programming

Vangos Pterneas

Develop and deploy your first secure and scalable real-time web application
RRP $17.99
RRP $29.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781782166962
Paperback110 pages

About This Book

  • Start real-time communication in your web applications
  • Create a feature-rich WebSocket chat application
  • Learn the step-by-step configuration of the server and clients

Who This Book Is For

This book is for anyone who wants to build high-performance, true, real-time web applications. Being familiar with frontend web development (HTML / XHTML, JavaScript) would be ideal.

Table of Contents

Chapter 1: WebSocket – a Handshake!
Life before WebSocket
Then came HTML5
The WebSocket protocol
The future is now
What are we going to make?
Chapter 2: The WebSocket API
HTML5 basics
A chatting application
API overview
Chapter 3: Configuring the Server
Why do I need a WebSocket server?
Setting up the server
Connecting to the web server
Other methods
The complete source code
Chapter 4: Data Transfer – Sending, Receiving, and Decoding
What kinds of data can WebSockets transfer?
Putting it all together
Chapter 5: Security
WebSocket headers
Common attacks
WebSocket native defence mechanisms
Security toolbox
Chapter 6: Error Handling and Fallbacks
Error handling
Fallback solutions
Chapter 7: Going Mobile (and Tablet, Too)
Why mobile matters
Going native
What about the iPad?

What You Will Learn

  • Understand the concepts of the WebSocket API and why it is superior to the existing techniques
  • Implement a WebSocket client that will connect to a remote server and transmit messages to other clients
  • Configure a WebSocket server using your existing skills and knowledge
  • Implement native WebSocket clients for mobile and tablet devices
  • Support older browsers that do not support HTML5 WebSockets

In Detail

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.

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.

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.

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.


Read More