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)

Common attacks


Currently, what you need to know is that the protocol is designed to be as secure as possible. Be careful though! WebSocket is a brand-new protocol and not all web browsers implement it correctly. For example, some of them still allow the mix of HTTP and WS, although the specification implies the opposite. Everything is subject to change, and while waiting for the browsers to mature, you can easily adopt some protection techniques yourself.

So, the old-school problems are not solved. Remember those bad people who sniffed the HTTP and intercepted into the web traffic? Well, the WS can be sniffed the same way.

Here are some common security attacks you need to be aware of, and consequently, some ways you can protect your app and your users.

Denial of Service

Denial of Service (DoS) attacks attempt to make a machine or network resource unavailable to the users that request it. Imagine that someone makes an infinite number of requests to a web server with no or tiny time intervals...