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)

Index

A

  • actions, WebSocket API
    • send() / send()
    • close() / close()
  • AJAX
    • about / Postback and AJAX, Browser support
  • AJAX polling
    • about / JavaScript polyfills
  • Apache Tomcat
    • URL / Java
  • API
    • about / API overview
  • ArrayBuffer
    • about / ArrayBuffer
  • Atmosphere
    • URL / Java
    / Popular polyfills
  • Autobahn
    • URL / Python

B

  • basics, HTML5
    • markup / Markup
    • styling / Styling
    • logic / Logic
  • binaryType property / Properties
  • Blob
    • video streaming / Video streaming
  • Blobs
    • about / Blobs
  • Bristleback
    • URL / Java
  • browser developer tools
    • about / Browser developer tools
  • browser plugins
    • about / Browser plugins
  • browser support, WebSocket API / Browser support
  • bufferedAmount property / Properties

C

  • C#
    • advantages / Setting up the development environment
    • used, for setting up Fleck WebSocket server / Setting up the development environment
  • C# Action
    • about / Creating the WebSocket server instance
  • C/C++, WebSocket server libraries
    • Libwebsockets / Selecting the technology that suits you
    • Mongoose / Selecting the technology that suits you
    • Tufao / Selecting the technology that suits you
    • Wslay / Selecting the technology that suits you
  • chat.js / chat.js
  • chatting application / A chatting application
  • Client-to-Server masking / Client-to-Server masking
  • close() method / close()
  • close event
    • about / Close
  • common attacks
    • about / Common attacks
    • Denial of Service (DoS) / Denial of Service
    • Man-in-the-middle / Man-in-the-middle
    • Cross-site scripting (XSS) / XSS
  • Cross-site scripting (XSS)
    • about / XSS
  • CSS
    • about / Styling
  • CSS3
    • URL / Styling

D

  • DataChannel
    • about / Popular polyfills
  • data transfer, WebSocket protocol
    • String / String
    • ArrayBuffer / ArrayBuffer
    • Blob / Blobs
  • Denial of Service (DoS) attacks
    • about / Denial of Service
  • development environment
    • setting up / Setting up the development environment

E

  • echo.websocket.org server / What about the server?
  • EM-WebSocket
    • URL / Ruby
  • error handling
    • about / Error handling
    • network availability, checking / Checking network availability
  • events, WebSocket API
    • onopen / onopen
    • onmessage / onmessage
    • onclose / onclose
    • onerror / onerror
  • existing code
    • testing, in mobile browser / Testing our existing code in the mobile browser

F

  • Facebook / Postback and AJAX, JSON
  • fallback solutions
    • about / Fallback solutions
    • JavaScript polyfills / JavaScript polyfills
    • browser plugins / Browser plugins
  • Fiddler
    • about / Fiddler
    • URL, for downloading / Fiddler
  • Fleck
    • URL / .NET
  • Fleck library
    • features / Setting up the development environment
  • Fleck WebSocket server
    • setting up, C# used / Setting up the development environment
  • frame
    • about / Video streaming

G

  • Gamooga
    • about / Who's using WebSockets
  • Github / JSON
  • GitLive
    • about / Who's using WebSockets
  • GlassFish
    • URL / Java
  • Google Chrome
    • about / Blobs
  • Graceful WebSocket library
    • about / Popular polyfills
    • example / Popular polyfills

H

  • Hoar
    • URL / PHP
  • HTML5
    • about / Then came HTML5
    • basics / HTML5 basics, Styling, Logic
    • using / JavaScript polyfills
    • URL / Online sources
  • HTML5 demos
    • URL / Online sources
  • HTML5 markup
    • about / Markup
    • URL / Markup
  • HTML5 rocks
    • URL / Online sources
  • HTTP
    • about / Postback and AJAX

I

  • IDEs
    • Aptana / Setting up the development environment
    • NetBeans / Setting up the development environment
    • Eclipse (with the Web Developer plugin) / Setting up the development environment
    • Visual Studio / Setting up the development environment
    • WebMatrix / Setting up the development environment
  • images
    • sending, to server / Sending images to the server
  • index.html / index.html
  • Internet Information Services 8
    • URL / .NET
  • iPad devices
    • about / What about the iPad?
  • iPad simulator / Installing the SDK
  • IRC Cloud
    • about / Who's using WebSockets

J

  • Java, WebSocket server libraries
    • JBoss / Selecting the technology that suits you
    • GlassFish / Selecting the technology that suits you
    • Atmosphere / Selecting the technology that suits you
    • Jetty / Selecting the technology that suits you
    • Bristleback / Selecting the technology that suits you
    • Apache Tomcat / Java
    • Play Framework / Java
    • Migratory data / Java
  • JavaScript
    • about / Logic
    • example / Logic
  • JavaScript, WebSocket server libraries
    • Socket IO / JavaScript
    • WebSocket-Node / JavaScript
    • Node WebSocket Server / JavaScript
  • JavaScript hacks / Fallback solutions
  • JavaScript polyfills
    • about / JavaScript polyfills
  • JBoss
    • URL / Java
  • Jetty
    • URL / Java
  • jQuery
    • about / XML
  • JSON
    • about / String, JSON
    • used, for sending message / Sending the nickname and message using JSON
  • jWebSocket
    • URL / Java

K

  • Kaazing
    • about / Who's using WebSockets, Popular polyfills
  • Kaazing WebSocket Gateway / Popular polyfills

L

  • Libwebsockets
    • URL / C/C++
  • logic
    • about / Logic
  • long polling
    • about / Long polling, Postback and AJAX

M

  • Man-in-the-middle attacks
    • about / Man-in-the-middle
  • masking key / Client-to-Server masking
  • message event / Message
  • Migratory data
    • URL / Java
  • mobile browser
    • existing code, testing in / Testing our existing code in the mobile browser
  • mobile website
    • versus native mobile app / Native mobile app versus mobile website
  • Modernizr
    • about / Popular polyfills
  • Mongoose
    • URL / C/C++
  • Mozilla Developer Network
    • URL / Online sources

N

  • .NET, WebSocket server libraries
    • Fleck / .NET
    • SuperWebSocket / .NET
    • Internet Information Services 8 / .NET
  • native defence mechanisms, WebSocket
    • about / WebSocket native defence mechanisms
    • SSH/TLS / SSH/TLS
    • Client-to-Server masking / Client-to-Server masking
  • native mobile app
    • versus mobile website / Native mobile app versus mobile website
    • about / Going native
    • project, creating / Creating the project
  • network availability
    • checking / Checking network availability
  • Node.js
    • URL / JavaScript
    • about / JavaScript

O

  • Objective-C
    • about / Going native
  • OnBinary event / Other methods
  • onclose event / onclose
  • ondrop event / Sending images to the server
  • onerror event / onerror
  • online sources
    • about / Online sources
    • WebSocket.org / Online sources
    • Web Platform docs / Online sources
    • HTML5 rocks / Online sources
    • HTML5 demos / Online sources
    • Mozilla Developer Network / Online sources
    • The WebSockets API (W3C) / Online sources
  • onmessage event / onmessage
    • about / String
  • OnMessage event / Other methods
  • OnMessage method / Sending images to the server
  • onopen event / onopen
  • open event / Open
  • origin
    • about / WebSocket headers

P

  • PHP, WebSocket server libraries
    • Php-websocket / PHP
    • Rachet / PHP
    • Hoar / PHP
  • Php-websocket
    • URL / PHP
  • Play Framework
    • URL / Java
  • plugins / Fallback solutions
  • polling
    • about / Polling
  • polyfill
    • using / JavaScript polyfills
  • polyfills
    • network connectivity, checking / Checking network availability
    • about / Fallback solutions, Popular polyfills
  • Portal
    • about / Popular polyfills
  • postback
    • about / Postback and AJAX
  • project
    • creating, XCode used / Creating the WebSocket iPhone app
  • properties, WebSocket API
    • url / Properties
    • protocol / Properties
    • readyState / Properties
    • bufferedAmount / Properties
    • binaryType / Properties
  • protocol property / Properties
  • Pusher
    • about / Who's using WebSockets
  • Python, WebSocket server libraries
    • Tornado / Python
    • Pywebsocket / Python
    • Autobahn / Python
    • txWS / Python
    • WebSocket for Python / Python
  • Pywebsocket
    • URL / Python

R

  • Rachet
    • URL / PHP
  • readyState property / Properties
  • resources, WebSocket API
    • about / Resources
    • online sources / Online sources
    • articles / Articles
  • revokeObjectURL function
    • about / Video streaming
  • RFC 6455 / Browser support
  • Ruby, WebSocket server libraries
    • EM-WebSocket / Ruby
    • Socky server / Ruby

S

  • Sec-WebSocket-Version parameter
    • about / WebSocket headers
  • security toolbox
    • about / Security toolbox
    • Fiddler / Fiddler
    • Wireshark / Wireshark
    • browser developer tools / Browser developer tools
    • ZAP / ZAP
  • send() method / send()
  • Send() method / Send
  • server
    • images, sending to / Sending images to the server
  • server-side source code
    • about / The complete source code
  • Smarkets
    • about / Who's using WebSockets
  • smartphone
    • about / Why mobile matters
  • smartphone app
    • prequisites / Prerequisites
    • SDK, installing / Installing the SDK
  • socket.io / Popular polyfills
  • SockJS / Popular polyfills
  • Socky server
    • URL / Ruby
  • source code, WebSocket API
    • system requisites / System requirements
  • SSH/TLS / SSH/TLS
  • streaming
    • about / Streaming
  • String
    • about / String
    • JSON / JSON
    • XML / XML
  • Superfeedr
    • about / Who's using WebSockets
  • SuperWebSocket
    • URL / .NET

T

  • The WebSockets API (W3C) / Online sources
  • Tornado
    • URL / Python
  • Tufao
    • URL / C/C++
  • Twitter / JSON
  • txWS
    • URL / Python

U

  • url property / Properties
  • users, WebSockets
    • Kaazing / Who's using WebSockets
    • Gamooga / Who's using WebSockets
    • GitLive / Who's using WebSockets
    • Superfeedr / Who's using WebSockets
    • Pusher / Who's using WebSockets
    • Smarkets / Who's using WebSockets
    • IRC Cloud / Who's using WebSockets

V

  • video
    • about / Video streaming
  • video streaming
    • about / Video streaming

W

  • web-socket-js / Popular polyfills
  • Web Platform docs
    • URL / Online sources
  • WebRTC
    • URL / Video streaming
  • WebSocket
    • about / The WebSocket protocol
    • URL example / The URL
    • browser support / Browser support
    • URL, for demos / Who's using WebSockets
    • native defence mechanisms / WebSocket native defence mechanisms
  • websocket-as / Browser plugins
  • WebSocket.org
    • URL / Online sources
  • WebSocket API
    • about / API overview
    • browser support / Browser support
    • events / Events, onmessage, onclose
    • actions / Actions, close()
    • properties / Properties
    • example / The complete example
    • resources / Resources
    • source code / Source code
  • WebSocket chat client
    • about / The complete source code
  • WebSocket for Python
    • URL / Python
  • WebSocket headers
    • about / WebSocket headers
  • WebSocket object
    • about / The WebSocket object
  • WebSocket protocol
    • about / What kinds of data can WebSockets transfer?
  • WebSockets
    • users / Who's using WebSockets
    • about / Mobile?
  • WebSocket server
    • need for / Why do I need a WebSocket server?
    • and client event triggering / Why do I need a WebSocket server?
    • setting up / Setting up the server
    • development server, setting up / Setting up the development environment
    • connecting to / Connecting to the web server
  • WebSocket server implementations
    • open event / Open
    • close event / Close
    • message event / Message
    • Send() method / Send
    • OnBinary event / Other methods
    • OnMessage event / Other methods
  • WebSocket server instance
    • creating / Creating the WebSocket server instance
  • Wireshark
    • about / Wireshark
    • URL, for downloading / Wireshark
  • Wslay
    • URL / C/C++

X

  • XCode
    • about / Creating the project
    • used, for creating project / Creating the WebSocket iPhone app
  • XML
    • about / String, XML
  • XmlHttpRequest
    • about / Postback and AJAX
  • XMLHttpRequest / Checking network availability

Z

  • ZAP
    • about / ZAP
    • URL, for downloading / ZAP