Getting Started with HTML5 WebSocket Programming

Getting Started with HTML5 WebSocket Programming
eBook: $17.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $47.98    Print cover: $29.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 110 pages [ 235mm x 191mm ]
Release Date : August 2013
ISBN : 1782166963
ISBN 13 : 9781782166962
Author(s) : Vangos Pterneas
Topics and Technologies : All Books, Web Development, Open Source

Table of Contents

Chapter 1: WebSocket – a Handshake!
Chapter 2: The WebSocket API
Chapter 3: Configuring the Server
Chapter 4: Data Transfer – Sending, Receiving, and Decoding
Chapter 5: Security
Chapter 6: Error Handling and Fallbacks
Chapter 7: Going Mobile (and Tablet, Too)
  • Chapter 1: WebSocket – a Handshake!
    • Life before WebSocket
      • Polling
      • Long polling
      • Streaming
      • Postback and AJAX
    • Then came HTML5
    • The WebSocket protocol
      • The URL
      • Browser support
      • Who's using WebSockets
    • Mobile?
    • The future is now
    • What are we going to make?
    • Summary
    • Chapter 2: The WebSocket API
      • HTML5 basics
        • Markup
        • Styling
        • Logic
      • A chatting application
      • API overview
        • Browser support
        • The WebSocket object
        • Events
          • onopen
          • onmessage
          • onclose
          • onerror
        • Actions
          • send()
          • close()
        • Properties
        • The complete example
          • index.html
          • chat.js
        • What about the server?
      • Summary
      • Chapter 3: Configuring the Server
        • Why do I need a WebSocket server?
        • Setting up the server
          • Selecting the technology that suits you
            • C/C++
            • Java
            • .NET
            • PHP
            • Python
            • Ruby
            • JavaScript
          • Setting up the development environment
        • Connecting to the web server
          • Creating the WebSocket server instance
          • Open
          • Close
          • Message
          • Send
        • Other methods
        • The complete source code
        • Summary
          • Chapter 5: Security
            • WebSocket headers
            • Common attacks
              • Denial of Service
              • Man-in-the-middle
              • XSS
            • WebSocket native defence mechanisms
              • SSH/TLS
              • Client-to-Server masking
            • Security toolbox
              • Fiddler
              • Wireshark
              • Browser developer tools
              • ZAP
            • Summary
              • Chapter 7: Going Mobile (and Tablet, Too)
                • Why mobile matters
                  • Native mobile app versus mobile website
                  • Prerequisites
                  • Installing the SDK
                  • Testing our existing code in the mobile browser
                • Going native
                  • Creating the project
                  • Creating the WebSocket iPhone app
                • What about the iPad?
                • Summary
                • Appendix
                  • Resources
                    • Online sources
                    • Articles
                  • Source code
                    • System requirements
                    • Stay in touch

                  Vangos Pterneas

                  Vangos Pterneas is a Software Engineer, passionate about natural user interfaces and modern innovative technologies. He loves developing smart clients for the Web and mobile devices. His professional experience includes iOS, Windows, Kinect, and HTML5 development for small and large-scale systems.

                  Vangos has worked as a Software Engineer and Consultant for Microsoft Innovation Center, where he participated in EU research projects and carried out numerous technical presentations and workshops. He is now running his own company, LightBuzz Software, introducing new concepts and software to the public. LightBuzz applications have won the first place in Microsoft's worldwide innovation competition, held in New York, and also the first place in TEDx's Rising Stars program.

                  Apart from this book, Vangos has reviewed Augmented Reality with Kinect, published by Packt Publishing.

                  When Vangos is not coding, he loves blogging about technical staff and providing the community with open-source utilities (

                  Sorry, we don't have any reviews for this title yet.

                  Code Downloads

                  Download the code and support files for this book.

                  Submit Errata

                  Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

                  Sample chapters

                  You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                  Frequently bought together

                  Getting Started with HTML5 WebSocket Programming +    Implementing Cloud Storage with OpenStack Swift =
                  50% Off
                  the second eBook
                  Price for both: £18.75

                  Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                  What you will learn from this book

                  • 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.


                  Getting Started with HTML5 Websocket Programming takes a tutorial-based approach.

                  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.

                  Code Download and Errata
                  Packt Anytime, Anywhere
                  Register Books
                  Print Upgrades
                  eBook Downloads
                  Video Support
                  Contact Us
                  Awards Voting Nominations Previous Winners
                  Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                  Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software