HTML 5 WebSocket delivers the Real-time Web QCon, San Francisco - - PowerPoint PPT Presentation

html 5 websocket delivers the real time web
SMART_READER_LITE
LIVE PREVIEW

HTML 5 WebSocket delivers the Real-time Web QCon, San Francisco - - PowerPoint PPT Presentation

HTML 5 WebSocket delivers the Real-time Web QCon, San Francisco November 18, 2009 1 Introduction John Fallows CTO @ Kaazing Author @ Pro JSF & Ajax Contributor @ W3C HTML 5 Contributor @ IETF Bidirectional Hypertext


slide-1
SLIDE 1 1

HTML 5 WebSocket delivers the Real-time Web

QCon, San Francisco November 18, 2009

slide-2
SLIDE 2 2

Introduction

  • John Fallows
  • CTO @ Kaazing
  • Author @ Pro JSF & Ajax
  • Contributor @ W3C HTML 5
  • Contributor @ IETF Bidirectional Hypertext
  • Kaazing Corporation
  • Founded May 2007
  • Based in Mountain View, California, USA
  • Provides Kaazing WebSocket Gateway
slide-3
SLIDE 3 3

What is Real-time?

  • Hard real-time systems
  • Heart pacemaker – increased latency is

useless

  • Soft real-time systems
  • Multimedia streaming – increased latency is

recoverable

slide-4
SLIDE 4 4

Real-time Web challenge

  • HTTP is the foundation of the Web
  • Designed for document transfer
  • Client-initiated request-response
  • Intermediate proxies add complexity
  • Internet adds variable latency
  • Web applications demand real-time
  • Social networking
  • Internet gaming
  • Financial services
slide-5
SLIDE 5 5

Half-duplex Architecture ☹

slide-6
SLIDE 6 6

HTML 5 Overview

  • Next generation application platform
  • Communication (sockets, cross-origin)
  • Graphics (2D)
  • Drag ‘n’ drop
  • Storage (transient, persistent)
  • Offline
  • Compatibility
  • “Last Call” October 2009
slide-7
SLIDE 7 7

HTML 5 Communication

  • WebSocket
  • HTTP-friendly text socket for your browser
  • Server-Sent Events
  • Standardized HTTP streaming (downstream)
  • Cross-Origin XMLHttpRequest
  • Secure cross-origin remote communication
  • postMessage
  • Secure cross-document local communication
slide-8
SLIDE 8 8

HTML 5 WebSocket

  • Full-duplex, bidirectional text socket
  • Send and receive strings
  • Browser native support
  • Chrome 4.0 beta
  • Mozilla Firefox trunk
  • Kaazing emulation support
  • IE 5.5+, Firefox 2.0+, Opera 9.61+,

Safari 3.2+, Chrome 2.0+

slide-9
SLIDE 9 9

HTML 5 WebSocket API

[Constructor(in DOMString url, in optional DOMString protocol)] interface WebSocket { readonly attribute DOMString URL; // ready state const unsigned short CONNECTING = 0; const unsigned short OPEN = 1; const unsigned short CLOSED = 2; readonly attribute unsigned short readyState; readonly attribute unsigned long bufferedAmount; // networking attribute Function onopen; attribute Function onmessage; attribute Function onclose; boolean send(in DOMString data); void close(); };

slide-10
SLIDE 10 10

HTML 5 WebSocket Handshake

GET /real-time HTTP/1.1\r\n Upgrade: WebSocket\r\n Connection: Upgrade\r\n …\r\n HTTP/1.1 101 WebSocket Protocol Handshake\r\n Upgrade: WebSocket\r\n Connection: Upgrade\r\n …\r\n

slide-11
SLIDE 11 11

HTML 5 WebSocket Framing

  • Frames can be sent full-duplex
  • Either direction at any time
  • Text or binary frames
  • Lead byte indicates frame type
  • Text Frames use terminator
  • \x80Hello, WebSocket\0xff
  • Binary Frames use length prefix
  • \x00\0x10Hello, WebSocket
slide-12
SLIDE 12 12

HTML 5 WebSocket Efficiency

  • Send “Hello, world” message client-to-server
  • “Hello, world” + 2 bytes framing (WebSocket)
  • “Hello, world” + ~1K headers (Ajax)
  • Plus the response overhead – network, memory & CPU
  • Plus request queuing delays at client
  • Send “Hello, world” message server-to-client
  • “Hello, world” + 2 bytes framing (WebSocket)
  • “Hello, world” + ~1K headers (Ajax)
  • Plus polling or long-polling empty request-reponse overhead
  • Plus buffer memory between polls at server
slide-13
SLIDE 13 13

HTML 5 WebSocket Security

  • Wire encryption via TLS / SSL
  • ws://kaazing.net/clear
  • wss://kaazing.net/encrypted
  • Cross-Origin WebSocket connections
  • Sandbox execution model
  • Origin: http://www.kaazing.com:80
  • WebSocket-Origin: http://www.kaazing.com:80
  • HTTP authentication and authorization
  • WebSocket handshake is traditional HTTP
slide-14
SLIDE 14 14

Full-duplex Architecture ☺

slide-15
SLIDE 15 15

DEMO

“Web Sockets in action”

slide-16
SLIDE 16 16

Kaazing WebSocket Gateway

  • High-Performance WebSocket Server
  • Optimized for minimal overhead per

connection

  • High availability clustering
  • Optimized for minimal intra-cluster

communication

  • Protocol-specific acceleration
  • Driven by customer demand
slide-17
SLIDE 17 17

Kaazing WebSocket Client

  • Emulation via HTTP streaming
  • Long-polling is a configuration error (!)
  • Cross-origin also supported by emulation
  • HTTP proxy detection
  • Dynamically adapt to proxy behavior
  • Recover from server failure
  • Automatically reconnect
  • Fallback to disaster recovery site
  • Support plug-in technolgies too
  • Flash, Silverlight, Java(FX)
slide-18
SLIDE 18 18

Kaazing ByteSocket

  • HTML 5 WebSocket is text-only
  • Send and receive strings
  • Kaazing ByteSocket supports binary
  • Send and receive ByteBuffers
  • ByteBuffers contain different types
  • Fixed-width integers
  • UTF8 strings
slide-19
SLIDE 19 19

Kaazing Protocols

  • JMS (Stomp)
  • AMQP
  • XMPP
  • IRC
  • Telnet
  • ...
slide-20
SLIDE 20 20

Kaazing WebSocket Acceleration

  • Connection-offloading
  • Reduce target server kernel overhead
  • Minimize redundant network traffic
  • Global message delivery
  • Deploy Kaazing WebSocket Gateway at edge
  • Dramatically reduce message latency
  • No need for VPN or leased line solutions
  • Use secure WebSocket to reach central Gateway
slide-21
SLIDE 21 21

Kaazing WebSocket Acceleration

slide-22
SLIDE 22 22

Kaazing High Availability

  • Layer 4 (TCP) load balancing
  • In-band for entire WebSocket connection
  • Compatible with existing half-duplex deployments
  • Potential bottleneck for full-duplex real-time
  • Layer 7 (HTTP) load balancing
  • Used during connection attempt only
  • Redirected location used directly
  • Eliminates balancer bottleneck
  • Reduces balancer scalability requirements
slide-23
SLIDE 23 23

Kaazing Disaster Recovery

  • Disaster eliminates entire data center
  • Examples – earthquake, flood
  • Recovery site available
  • Existing WebSocket clients
  • Automatically reconnect to recovery site
  • Recovers interaction state seamlessly
  • New clients
  • Download cached application
  • Connect to disaster recovery site
slide-24
SLIDE 24 24

DEMO

“Kaazing WebSocket Gateway”

slide-25
SLIDE 25 25

Summary

  • HTML 5 WebSocket delivers the Real-time Web
  • Kaazing delivers HTML 5 WebSocket
  • Kaazing WebSocket Gateway
  • 60-day free trial
  • http://www.kaazing.com
  • 24x7 support available
  • Kaazing WebSocket client emulation
  • Older generation browsers supported
  • Browser plug-ins NOT required
  • Browser plug-ins also supported directly
slide-26
SLIDE 26 26

Q & A

“Is that a WebSocket in your browser?”

slide-27
SLIDE 27 27