Kaazing

Alexander Ainslie
Alexander AinslieDirector, A3Capital Limited at CE Partners Ltd. (BVI)
Comet Never More!
(HTML 5 WebSockets in Theory and Practice)


         Jonas Jacobi & John R. Fallows
         Founders
         Kaazing




                     www.devoxx.com
Speaker’s qualifications
 John and Jonas are founders of Kaazing, provider of the
 open sourcre HTML 5 Websocket gateway
 Both dudes are frequent writers for magazines such as
 JDJ, JavaMagazine, and AjaxWorld
 John and Jonas speak frequently at conferences World
 Wide on HTML 5 Communication
 Authors of Pro JSF and Ajax: Building Rich Internet
 Components




  3
                           www.devoxx.com
Overall Presentation Goal

      Learn how to architect and build
     full-duplex Web applications using
           HTML 5 communication




                   www.devoxx.com
If we were not restricted by the traditional limitations of
 HTTP, what type of Web applications would we build?




                           www.devoxx.com
DEMO
Web Networking Usecases
for Work and Play




                          www.devoxx.com
Agenda, or something …
 Part 1 – Comet and the Future
  Real-time Web

  Comet/Reverse Ajax

  HTML 5 Communication

 Break (30 minutes)
 Part 2 – Full-duplex Web Today
  Networking Review

  HTML 5 WebSockets

  Kaazing Gateway

  7
                          www.devoxx.com
Defining Real-Time Web


Web Applications Typically Not Real-Time




                  www.devoxx.com
Defining Real-Time Web




            www.devoxx.com
Defining Real-Time Web
    Or, is it just nearly, nearly real-time?




                      www.devoxx.com
Defining Real-Time Web
    Or, is it just nearly, nearly real-time?




                      www.devoxx.com
Ajax (XHR)
 Updates Limited To Preset Interval
   Message buffering increases memory usage
   Near real-time updates achieved with shorter intervals

 Shorter Updates Cause
   Increased network traffic
   Higher frequency connection setup & teardown




                              www.devoxx.com
Push Technology History
 Push technology has been around for a while:
   Pushlets (2002)
   Bang Networks (early adopter)

 Previous attempts failed, because:
   Scalability Limitations (Cost etc…)
   Not general purpose
   No standard




                            www.devoxx.com
Push Technology
 Server-Initiated Message Delivery
   Clients are listening
   Clients behind firewalls

 Techniques such as Comet/Reverse Ajax
 Delays Completion of HTTP Response
 Generally Implemented in JS




                             www.devoxx.com
Long Polling and Streaming
 Current Comet implementations center around two
 major areas:
   Long Polling
   Streaming




                       www.devoxx.com
Long Polling
 Also known as asynchronous-polling
 Request open for a set period
 HTTP headers often account for more than half of the
 network traffic




                         www.devoxx.com
Long Polling HTTP Request
From client (browser) to server:
GET /long-polling HTTP/1.1rn
Host: www.kaazing.comrn
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9)
   Gecko/2008061017 Firefox/3.0rn
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
   *;q=0.8rn
Accept-Language: en-us,en;q=0.5rn
Accept-Encoding: gzip,deflatern
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7rn
Keep-Alive: 300rn
Connection: keep-alivern
Cache-Control: max-age=0rn
rn

                             www.devoxx.com
Long Polling HTTP Response
From server to client (browser):

Date: Tue, 16 Aug 2008 00:00:00 GMTrn
Server: Apache/2.2.9 (Unix)rn
Content-Type: text/plainrn
Content-Length: 12rn
rn
Hello, world




                             www.devoxx.com
HTTP Streaming
 Persistent HTTP Connection
   Pending POST

 Minimizes Latency
 Reduction in Network Traffic
 Optimizes Connection Setup & Tear-Down
   Keep-alive
   Security



                        www.devoxx.com
Today’s Architecture
                                                           Java EE Container

                                                                       RMI -                            JDBC -
                                                                  TCP (Full Duplex)                 TCP (Full Duplex)         Database
                                                                                      EJB
                                    Application Transport Logic




                                                                                                        IMAP -
                                                                     RMI                            TCP (Full Duplex)
                                                                                 JavaMail                                 IMAP Server
                          Servlet




                                                                                                      JABBER -
                                                                                                    TCP (Full Duplex)
                                                                                                                              IM Server

              HTTP
                                                                                                                                             Custom -
Browser




          (Half Duplex)                                                                                  JMS -
                                                                     RMI                            TCP (Full Duplex)                     TCP (Full Duplex)
                                                                                      JMS                                                                      Stock




                                                                                                                               Trading
                                                                                                                                Client
                                                                                                                                Stock
                                                                                                                        JMS
                                                                                                                                                              Trading
                                                                                                                                                               Feed




                                                                                        www.devoxx.com
What’s Missing?
 Not a standard
 No true bi-directional communication
 No guaranteed message delivery
 Complex middle-tier architecture
   Adds unnecessary latency




                         www.devoxx.com
Evolving the Web
    Ajax      Comet/Reverse Ajax         WebSockets

   Server           Server                    Server




                                         Connect


                                                          Notify
                                Notify
   Firewall         Firewall                       Firewall




  Browser         Browser                 Browser



                    www.devoxx.com
HTML 5 Overview
 Next generation application platform
   Communication (sockets, cross-site)
   Graphics (2D)
   Drag ‘n’ drop
   Storage (transient, persistent)
   Offline
   Compatibility




                             www.devoxx.com
HTML 5 WebSockets
The Communication section:
  WebSockets
  Server-sent events

Not New; TCPConnection API and protocol were
initially drafted over two years ago




                       www.devoxx.com
HTML 5 Server-Sent Events
 Standardizes and formalizes how a continuous stream
 of data can be sent from a server to a browser
 Introduces eventsource—a new DOM element




                        www.devoxx.com
HTML 5 Server-Sent Events
Connects to a server URL to receive an event stream:


<eventsource src=             quot;http://
  stocks.kaazing.comquot;
  onmessage=quot;alert(event.data)quot;>




                          www.devoxx.com
HTML 5 Server-Sent Events
 Server can add the ID header so that clients add a
 Last-Event-ID header
 Used to guarantee message delivery
 Server specify an optional retry header as part of an
 event in the event stream




                          www.devoxx.com
HTML 5 WebSockets
Defines full-duplex communications
  Operates over a single socket

Traverses firewalls and routers seamlessly
Allows authorized cross-domain communication
Integrates with:
  Cookie-based authentication
  Existing HTTP load balancers



                          www.devoxx.com
HTML 5 WebSockets
Connection established by upgrading from the HTTP
protocol to the WebSocket protocol
WebSocket data frames can be sent back and forth
between the client and the server in full-duplex mode




                        www.devoxx.com
HTML 5 WebSockets
Supports a diverse set of clients
Cannot deliver raw binary data to JavaScript
  Binary data is ignored if the client is JavaScript

Enables direct communication with backend systems




                            www.devoxx.com
HTML 5 WebSockets
Detects presence of proxy servers
A tunnel is established by issuing an HTTP CONNECT
statement
Secure Web sockets over SSL can leverage the same
HTTP CONNECT technique




                       www.devoxx.com
Simplified Architecture
                                                    RMI -                  Java EE          JDBC -
                                               TCP (Full Duplex)                        TCP (Full Duplex)
                                                                                EJB

                                                    RMI -
                                               TCP (Full Duplex)
                                                                                JMS                          Database
                            WebSocket Server

                                                            JDBC - TCP (Full Duplex)




                                                            IMAP - TCP (Full Duplex)
                                                                                                            IMAP Server


                                                           Jabber - TCP (Full Duplex)
                                                                                                             IM Server

           TCP over HTTP
            (Full Duplex)
 Browser




                                                          Custom - TCP (Full Duplex)                           Stock
                                                                                                              Trading
                                                                                                               Feed




                                                               www.devoxx.com
HTML 5 WebSockets
Creating a WebSocket instance:

var myWebSocket = new WebSocket
(“ws://www.websocket.org”);




                         www.devoxx.com
HTML 5 WebSockets
Associating listeners:

myWebSocket.onopen = function(evt)
  { alert(“Connection open ...”); };
myWebSocket.onmessage = function(evt)
  { alert( “Received Message: ” +
  evt.data); };
myWebSocket.onclose = function(evt)
  { alert(“Connection closed.”); };




                         www.devoxx.com
HTML 5 WebSockets
Sending messages:

myWebSocket.postMessage(“Hello WebSocket!”);
myWebSocket.postMessage(“Goodbye Comet!”);
myWebSocket.disconnect();




                      www.devoxx.com
HTML 5 WebSockets
Enables full-duplex communication to any TCP-based
back-end service:
JMS
Jabber
Stomp
etc…




                      www.devoxx.com
Stomp Protocol
 Simple Text-Oriented Messaging Protocol (STOMP)
   Publish and Subscribe
   Transactional
   Acknowledgements

 ActiveMQ, RabbitMQ, …




                           www.devoxx.com
Stomp Protocol
var myStomp = new StompClient();



myStomp.onopen = function(headers)
  { myStomp.send(“Hello STOMP!”, “/topic/
  destination”); }

myStomp.onmessage =
  function(headers, body) { alert(body); }



myStomp.connect(“ws://www.websocket.org/stomp”);

myStomp.subscribe(destination.value);



                          www.devoxx.com
DEMO
XMPP client




              www.devoxx.com
HTML 5 – When??
2022 AD (Not really)
Opera already has Server Sent Events
Mozilla/Firefox patch available – Bug 338583
Kaazing.org provides this NOW!!!
      IE 5.5+, Firefox 1.5+, Chrome 0.2+, Safari 3.1+, Opera 9.0+




 39
                               www.devoxx.com
Summary
Server-Sent Events standardize and formalize Comet/
Reverse Ajax
WebSockets provides full-duplex communication
Do I have to wait till 2022 AD?




 40
                         www.devoxx.com
www.devoxx.com
Comet Never More!
(HTML 5 WebSockets in Theory and Practice)


         John R. Fallows & Jonas Jacobi
         Founders
         Kaazing




                     www.devoxx.com
Agenda, or something …
  Part 1 – Comet and the Future
   Real-time Web

   Comet/Reverse Ajax

   HTML 5 Communication

  Break (30 minutes)
  Part 2 – Full-duplex Web Today
   Networking Review

   HTML 5 WebSockets

   Kaazing Gateway
                          www.devoxx.com
Networking Review
 Desktop Networking
   Full-duplex bidirectional TCP sockets
   Access any server on the network

 Browser Networking
   Half-duplex HTTP request-response
   HTTP polling, long polling, streaming
   Same-origin HTTP requests




                            www.devoxx.com
Half-Duplex Architecture
                                                           Java EE Container

                                                                       RMI -                            JDBC -
                                                                  TCP (Full Duplex)                 TCP (Full Duplex)         Database
                                                                                      EJB
                                    Application Transport Logic




                                                                                                        IMAP -
                                                                     RMI                            TCP (Full Duplex)
                                                                                 JavaMail                                 IMAP Server
                          Servlet




                                                                                                      JABBER -
                                                                                                    TCP (Full Duplex)
                                                                                                                              IM Server

              HTTP
                                                                                                                                             Custom -
Browser




          (Half Duplex)                                                                                  JMS -
                                                                     RMI                            TCP (Full Duplex)                     TCP (Full Duplex)
                                                                                      JMS                                                                      Stock




                                                                                                                               Trading
                                                                                                                                Client
                                                                                                                                Stock
                                                                                                                        JMS
                                                                                                                                                              Trading
                                                                                                                                                               Feed




                                                                                        www.devoxx.com
HTML 5 Communication
 WebSocket
   Proxy-friendly text socket for your browser

 Server-Sent Events
   Standardized HTTP streaming (downstream)

 Cross-Site XMLHttpRequest
   Secure cross-site remote communication

 postMessage
   Secure inter-iframe communication

                            www.devoxx.com
Full-duplex Architecture
                                                    RMI -                  Java EE          JDBC -
                                               TCP (Full Duplex)                        TCP (Full Duplex)
                                                                                EJB

                                                    RMI -
                                               TCP (Full Duplex)
                                                                                JMS                          Database
                            WebSocket Server

                                                            JDBC - TCP (Full Duplex)




                                                            IMAP - TCP (Full Duplex)
                                                                                                            IMAP Server


                                                           Jabber - TCP (Full Duplex)
                                                                                                             IM Server

           TCP over HTTP
            (Full Duplex)
 Browser




                                                          Custom - TCP (Full Duplex)                           Stock
                                                                                                              Trading
                                                                                                               Feed




                                                               www.devoxx.com
DEMO
Java Messaging Service




                         www.devoxx.com
Kaazing Protocols
                   Protocols


          ByteSocket



                  WebSocket

          Server-Sent
            Events


                Cross-Site XHR



                                   postMessage
                  IFrame
          XHR




                           www.devoxx.com
Kaazing ByteSocket
 Provides binary socket abstraction
 Leverages text-based WebSocket
   Encodes payload using base64

 Send and receive ByteBuffers
   JavaScript has no byte or ByteArray type (yet)

 Kaazing Gateway converts base64




                            www.devoxx.com
Kaazing ByteSocket
var location = “ws://www.kaazing.org/binary”;
var socket = new ByteSocket(location);
socket.onmessage = function(event) {
        alert(event.data.getInt());
  }


var buf = new ByteBuffer();
buf.putString(“Hello, world”, Charset.UTF8);
socket.postMessage(buf.flip());


                      www.devoxx.com
Kaazing ByteSocket
                   Protocols


         ByteSocket



                  WebSocket

         Server-Sent
           Events


                Cross-Site XHR


                                   postMessage
                  IFrame
          XHR




                           www.devoxx.com
HTML 5 WebSocket
Provides Full-Duplex Text Socket
Send and Receive Strings
Enables Streaming to Server Too
Browser Support
  None (yet)




                       www.devoxx.com
HTML 5 WebSocket Schemes

	 	   ws://www.kaazing.org/text


      wss://www.kaazing.org/encrypted-text




                   www.devoxx.com
HTML 5 WebSocket API

 var location = “ws://www.kaazing.org/text”;
    var socket = new WebSocket(location);


    socket.onopen = function(event) {
         socket.send(“Hello, WebSocket”);
    }

    socket.onmessage =
         function(event) { alert(event.data); }

    socket.onclose =
         function(event) { alert(“closed”); }

	
                        www.devoxx.com
HTML 5 WebSocket Handshake

 GET /text HTTP/1.1rn
  Upgrade: WebSocketrn
  Connection: Upgradern
  Host: www.kaazing.orgrn
  …rn


  HTTP/1.1 101 WebSocket Protocol Handshakern
  Upgrade: WebSocketrn
  Connection: Upgradern
  …rn



                     www.devoxx.com
HTML 5 WebSocket Frames
 Frames can be sent full-duplex
   Either direction at any time

 Text Frames use terminator
	 x80Hello, WebSocket0xff
 Binary Frames use length prefix
	 x000x10Hello, WebSocket

 Text and binary frames on same WebSocket


                           www.devoxx.com
Kaazing WebSocket
                  Protocols


         ByteSocket



                 WebSocket

         Server-Sent
           Events


               Cross-Site XHR


                                postMessage
                 IFrame
         XHR




                          www.devoxx.com
HTML 5 Server-Sent Events




            www.devoxx.com
HTML 5 Server-Sent Events
 HTML DOM Element

 <eventsource src=“http://www.kaazing.org/sse”
                 onmessage=“alert(event.data)” >

 HTML DOM API
 
    var es =
 document.createElement(“eventsource”);
        es.addEventListener(“message”,
            function(event) { alert(event.data); },
 false);
        es.addEventSource(“http://www.kaazing.org/
 sse”);




                         www.devoxx.com
HTML 5 Server-Sent Events

 GET /sse HTTP/1.1rn
  Host: www.kaazing.orgrn
  Last-Event-ID: 9rn
  …rn


 200 OK HTTP/1.1rn
 …rn

 :commentn
 id: 10n
 data: Hello, Server-Sent Eventsn
 n

                       www.devoxx.com
DEMO
HTML 5 Server-Sent Events




                            www.devoxx.com
Kaazing Server-Sent Events
                   Protocols


          ByteSocket



                  WebSocket

          Server-Sent
            Events


                Cross-Site XHR


                                 postMessage
                  IFrame
          XHR




                           www.devoxx.com
Cross-Site XMLHttpRequest
 W3C Technical Report
   Access Control for Cross-Site Requests
   Published Sept 12, 2008
   http://www.w3.org/TR/access-control/

 Browser Support
   Firefox 3.1-beta
   IE8 XDomainRequest (similar)
   Opera, Safari, Chrome coming


                             www.devoxx.com
Cross-Site XMLHttpRequest

 GET / HTTP/1.1rn
  Host: www.w3.orgrn
  Origin: http://www.kaazing.orgrn
  …rn


 200 OK HTTP/1.1rn
 Allow-Origin: http://www.kaazing.orgrn
 …rn




                     www.devoxx.com
DEMO
Cross-site XMLHttpRequest




                            www.devoxx.com
Kaazing Cross-Site XHR
                   Protocols


         ByteSocket



                  WebSocket

         Server-Sent
           Events


                Cross-Site XHR


                                 postMessage
                  IFrame
          XHR




                           www.devoxx.com
HTML 5 postMessage
    Send Strings Between HTML Documents
      Documents may be served by different sites

    Standard API

   targetWindow.postMessage(message, targetOrigin)
    window.onmessage = function(event) {
      alert(event.data);
    }

    Browser Support
      IE 8, FF 3, Opera 9, WebKit nightlies


                               www.devoxx.com
DEMO
HTML 5 postMessage




                     www.devoxx.com
Kaazing postMessage
                  Protocols


         ByteSocket



                 WebSocket

         Server-Sent
           Events


               Cross-Site XHR


                                postMessage
                 IFrame
         XHR




                          www.devoxx.com
Kaazing postMessage




            www.devoxx.com
Kaazing Protocols Support
                   Protocols


          ByteSocket



                  WebSocket

          Server-Sent
            Events


                Cross-Site XHR


                                 postMessage
                  IFrame
          XHR




                           www.devoxx.com
Kaazing Protocols
 Text or Binary
   Stomp
   XMPP
   IRC
   Telnet
   IMAP
   SMTP
   Custom…


                  www.devoxx.com
Kaazing Gateway Scalability
 Based on SEDA (Staged Event-Driven Architecture)
   Leverages Java New I/O (NIO)

 Concurrency
   Proportional to bandwidth not connections

 Latency
   Socket integration, bytes-in, bytes-out

 Stateless
   Minimal memory usage, balancing, failover

                            www.devoxx.com
Kaazing Gateway Security
                         www.server.co
                                                            IP
Domain Name                     m
                                                         Address
                         stock.server.co
   Server                       m                        65.43.2.
                                                                                                                                          Director
                          chat.server.co                    1
                                   Firewall                                Gatewa
                                m Public                                    yDMZ
                                                                                                                                             y
                                      IP                                      IP                                                           Server
                                   Addres                                  Addres
                                      s:                                      s:




                                                                                     >|< Kaazing Gateway




                                                                                                                                                     ldaps://directory.internal.net:
                                   65.43.2                                 10.0.0.
                                      .1                                      1
Web Page                                                    tcp://gateway.dmz.net:
                                   http://
                                                                     8080
Cha                    www.server.com:80

 t                                            Firewall




                                                                                                                                                                  636
                                                                                                                                           Stock
      Stoc                                                                                                                                 Serve
        k          wss://stock.server.com:                 tcp://gateway.dmz.net:                          tcp://stock.internal.net :        r
                             443                                    9090                                            61613

 Browser                                                                                                                                   Chat
                                                                                                                                           Serve
                                                                                                                                             r
                 wss://chat.server.com:443                tcp://gateway.dmz.net:                           tcp://chat.internal.net:5222
                                                                   9090


       Public Internet                                           DMZ                                                Internal Network
                    IP Addresses                                    IP Addresses                                                      IP Addresses
                   ! 10.0.0.0/24                                     10.0.0.0/24                                                   192.168.0.0/16
                ! 172.16.0.0/20
              ! 192.168.0.0/16                                www.devoxx.com
Kaazing Enterprise Gateway
 Features
   Adobe Flex APIs
   Flash runtime detection
   EncryptedKeyring
   Single sign-on
   Protocol Validation
   Protocol Security Enhancements
   Management


                             www.devoxx.com
DEMO
Kaazing XMPP Client




                      www.devoxx.com
Summary
HTML 5 Communication is here
WebSockets and SSE standardize Comet
Avoid vendor lock-in, the standards shall set you free!
Kaazing Community – www.kaazing.org




 78
                         www.devoxx.com
Concluding statement

 If HTTP did not restrict your creativity,
what Web application would YOU create?




                  www.devoxx.com
Q&A




      www.devoxx.com
Thanks for your attention!

       http://www.kaazing.org

        http://www.w3c.org




               www.devoxx.com
1 of 81

Recommended

Introduction to WebSockets Presentation by
Introduction to WebSockets PresentationIntroduction to WebSockets Presentation
Introduction to WebSockets PresentationJulien LaPointe
4.9K views16 slides
Extending JMS to Web Devices over HTML5 WebSockets - JavaOne 2011 by
Extending JMS to Web Devices over HTML5 WebSockets - JavaOne 2011Extending JMS to Web Devices over HTML5 WebSockets - JavaOne 2011
Extending JMS to Web Devices over HTML5 WebSockets - JavaOne 2011Peter Moskovits
5.2K views42 slides
Apache ActiveMQ and Apache ServiceMix by
Apache ActiveMQ and Apache ServiceMixApache ActiveMQ and Apache ServiceMix
Apache ActiveMQ and Apache ServiceMixBruce Snyder
7.1K views123 slides
Messaging With ActiveMQ by
Messaging With ActiveMQMessaging With ActiveMQ
Messaging With ActiveMQBruce Snyder
16.5K views75 slides
Messaging With Apache ActiveMQ by
Messaging With Apache ActiveMQMessaging With Apache ActiveMQ
Messaging With Apache ActiveMQBruce Snyder
8.5K views66 slides
Real time web apps by
Real time web appsReal time web apps
Real time web appsSepehr Rasouli
76 views43 slides

More Related Content

What's hot

ActiveMQ In Action - ApacheCon 2011 by
ActiveMQ In Action - ApacheCon 2011ActiveMQ In Action - ApacheCon 2011
ActiveMQ In Action - ApacheCon 2011Bruce Snyder
5.2K views49 slides
Enterprise Messaging With ActiveMQ and Spring JMS by
Enterprise Messaging With ActiveMQ and Spring JMSEnterprise Messaging With ActiveMQ and Spring JMS
Enterprise Messaging With ActiveMQ and Spring JMSBruce Snyder
12.2K views73 slides
Scalable applications with HTTP by
Scalable applications with HTTPScalable applications with HTTP
Scalable applications with HTTPPatrice Neff
225 views16 slides
Server-Side Programming Primer by
Server-Side Programming PrimerServer-Side Programming Primer
Server-Side Programming PrimerIvano Malavolta
1.9K views49 slides
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser... by
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...Damir Dobric
740 views20 slides
Softsphere 08 web services bootcamp by
Softsphere 08 web services bootcampSoftsphere 08 web services bootcamp
Softsphere 08 web services bootcampBill Buchan
617 views63 slides

What's hot(20)

ActiveMQ In Action - ApacheCon 2011 by Bruce Snyder
ActiveMQ In Action - ApacheCon 2011ActiveMQ In Action - ApacheCon 2011
ActiveMQ In Action - ApacheCon 2011
Bruce Snyder5.2K views
Enterprise Messaging With ActiveMQ and Spring JMS by Bruce Snyder
Enterprise Messaging With ActiveMQ and Spring JMSEnterprise Messaging With ActiveMQ and Spring JMS
Enterprise Messaging With ActiveMQ and Spring JMS
Bruce Snyder12.2K views
Scalable applications with HTTP by Patrice Neff
Scalable applications with HTTPScalable applications with HTTP
Scalable applications with HTTP
Patrice Neff225 views
Server-Side Programming Primer by Ivano Malavolta
Server-Side Programming PrimerServer-Side Programming Primer
Server-Side Programming Primer
Ivano Malavolta1.9K views
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser... by Damir Dobric
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
Damir Dobric740 views
Softsphere 08 web services bootcamp by Bill Buchan
Softsphere 08 web services bootcampSoftsphere 08 web services bootcamp
Softsphere 08 web services bootcamp
Bill Buchan617 views
Succeding with the Apache SOA stack by Johan Edstrom
Succeding with the Apache SOA stackSucceding with the Apache SOA stack
Succeding with the Apache SOA stack
Johan Edstrom2K views
QLogic Solutions - Microsoft Exchange Server by QLogic Corporation
QLogic Solutions - Microsoft Exchange ServerQLogic Solutions - Microsoft Exchange Server
QLogic Solutions - Microsoft Exchange Server
QLogic Corporation2.1K views
Enterprise Messaging with Apache ActiveMQ by elliando dias
Enterprise Messaging with Apache ActiveMQEnterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQ
elliando dias2K views
Simple web service vm by Mohammed246
Simple web service vmSimple web service vm
Simple web service vm
Mohammed246310 views
The History and Status of Web Crypto API (2012) by Channy Yun
The History and Status of Web Crypto API (2012)The History and Status of Web Crypto API (2012)
The History and Status of Web Crypto API (2012)
Channy Yun10.6K views
Implementing WebServices with Camel and CXF in ServiceMix by Adrian Trenaman
Implementing WebServices with Camel and CXF in ServiceMixImplementing WebServices with Camel and CXF in ServiceMix
Implementing WebServices with Camel and CXF in ServiceMix
Adrian Trenaman15.4K views
Apache ActiveMQ - Enterprise messaging in action by dejanb
Apache ActiveMQ - Enterprise messaging in actionApache ActiveMQ - Enterprise messaging in action
Apache ActiveMQ - Enterprise messaging in action
dejanb9.5K views
Developer Pitfalls & Strategies for Improving Mobile Web Developer Experience by Tasneem Sayeed
Developer Pitfalls & Strategies for Improving Mobile Web Developer ExperienceDeveloper Pitfalls & Strategies for Improving Mobile Web Developer Experience
Developer Pitfalls & Strategies for Improving Mobile Web Developer Experience
Tasneem Sayeed1.2K views
Web Architectures by Fulvio Corno
Web ArchitecturesWeb Architectures
Web Architectures
Fulvio Corno5.1K views
04.m3 cms streaming-protocol by tarensi
04.m3 cms streaming-protocol04.m3 cms streaming-protocol
04.m3 cms streaming-protocol
tarensi1.3K views
Cloud computing by Luqman by Luqman Shareef
Cloud computing by LuqmanCloud computing by Luqman
Cloud computing by Luqman
Luqman Shareef1.7K views
HWIOS Websocket CMS explained by os-networks
HWIOS Websocket CMS explainedHWIOS Websocket CMS explained
HWIOS Websocket CMS explained
os-networks1.3K views

Viewers also liked

Presentation websockets by
Presentation websocketsPresentation websockets
Presentation websocketsBert Poller
1.4K views31 slides
HTML5 WebSocket Introduction by
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket IntroductionMarcelo Jabali
9.3K views37 slides
Il primo anno di vita del bambino by
Il primo anno di vita del bambinoIl primo anno di vita del bambino
Il primo anno di vita del bambinoAzza
2K views21 slides
Intro to WebSockets by
Intro to WebSocketsIntro to WebSockets
Intro to WebSocketsGaurav Oberoi
6.7K views26 slides
Pushing the web — WebSockets by
Pushing the web — WebSocketsPushing the web — WebSockets
Pushing the web — WebSocketsRoland M
15.5K views47 slides
HTML5 WebSocket for the Real-Time Web and the Internet of Things by
HTML5 WebSocket for the Real-Time Weband the Internet of ThingsHTML5 WebSocket for the Real-Time Weband the Internet of Things
HTML5 WebSocket for the Real-Time Web and the Internet of ThingsPeter Moskovits
2.6K views46 slides

Viewers also liked(12)

Presentation websockets by Bert Poller
Presentation websocketsPresentation websockets
Presentation websockets
Bert Poller1.4K views
HTML5 WebSocket Introduction by Marcelo Jabali
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket Introduction
Marcelo Jabali9.3K views
Il primo anno di vita del bambino by Azza
Il primo anno di vita del bambinoIl primo anno di vita del bambino
Il primo anno di vita del bambino
Azza 2K views
Pushing the web — WebSockets by Roland M
Pushing the web — WebSocketsPushing the web — WebSockets
Pushing the web — WebSockets
Roland M15.5K views
HTML5 WebSocket for the Real-Time Web and the Internet of Things by Peter Moskovits
HTML5 WebSocket for the Real-Time Weband the Internet of ThingsHTML5 WebSocket for the Real-Time Weband the Internet of Things
HTML5 WebSocket for the Real-Time Web and the Internet of Things
Peter Moskovits2.6K views
Introduction to WebSockets by Gunnar Hillert
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
Gunnar Hillert8.8K views

Similar to Kaazing

Mom those things v1 by
Mom those things v1 Mom those things v1
Mom those things v1 von gosling
2.2K views83 slides
Loadrunner Protocol bundle list by
Loadrunner Protocol bundle listLoadrunner Protocol bundle list
Loadrunner Protocol bundle listBharath Marrivada
4.8K views1 slide
Apache Etch Introduction @ FOSDEM 2011 by
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011grandyho
16.4K views10 slides
RIA With Flex & Java Using BlazeDS by
RIA With Flex & Java Using BlazeDSRIA With Flex & Java Using BlazeDS
RIA With Flex & Java Using BlazeDSHien Luu
4.3K views40 slides
Elegant Systems Integration w/ Apache Camel by
Elegant Systems Integration w/ Apache CamelElegant Systems Integration w/ Apache Camel
Elegant Systems Integration w/ Apache CamelPradeep Elankumaran
3K views36 slides
Make easier Integration of your services with Fuse Solutions - RedHat 2013 by
Make easier Integration of your services with Fuse Solutions - RedHat 2013Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013Charles Moulliard
3.5K views82 slides

Similar to Kaazing(20)

Mom those things v1 by von gosling
Mom those things v1 Mom those things v1
Mom those things v1
von gosling2.2K views
Apache Etch Introduction @ FOSDEM 2011 by grandyho
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
grandyho16.4K views
RIA With Flex & Java Using BlazeDS by Hien Luu
RIA With Flex & Java Using BlazeDSRIA With Flex & Java Using BlazeDS
RIA With Flex & Java Using BlazeDS
Hien Luu4.3K views
Make easier Integration of your services with Fuse Solutions - RedHat 2013 by Charles Moulliard
Make easier Integration of your services with Fuse Solutions - RedHat 2013Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Charles Moulliard3.5K views
Complex End-to-End Testing by Erika Barron
Complex End-to-End TestingComplex End-to-End Testing
Complex End-to-End Testing
Erika Barron1.6K views
Apache Camel: The Swiss Army Knife of Open Source Integration by prajods
Apache Camel: The Swiss Army Knife of Open Source IntegrationApache Camel: The Swiss Army Knife of Open Source Integration
Apache Camel: The Swiss Army Knife of Open Source Integration
prajods5.4K views
SD Forum 1999 XML Lessons Learned by Ted Leung
SD Forum 1999 XML Lessons LearnedSD Forum 1999 XML Lessons Learned
SD Forum 1999 XML Lessons Learned
Ted Leung3.1K views
Windows Azure Interoperability by Mihai Dan Nadas
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure Interoperability
Mihai Dan Nadas4.1K views
(How) Does VA Smalltalk fit into today's IT landscapes? by Joachim Tuchel
(How) Does VA Smalltalk fit into today's IT landscapes?(How) Does VA Smalltalk fit into today's IT landscapes?
(How) Does VA Smalltalk fit into today's IT landscapes?
Joachim Tuchel2.9K views
Iot platform supporting million requests per second by Abinasha Karana
Iot platform supporting million requests per secondIot platform supporting million requests per second
Iot platform supporting million requests per second
Abinasha Karana553 views
wa-cometjava-pdf by Hiroshi Ono
wa-cometjava-pdfwa-cometjava-pdf
wa-cometjava-pdf
Hiroshi Ono909 views
Web Server/App Server Connectivity by webhostingguy
Web Server/App Server ConnectivityWeb Server/App Server Connectivity
Web Server/App Server Connectivity
webhostingguy2K views
The Art of Message Queues - TEKX by Mike Willbanks
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
Mike Willbanks8K views
Js remote conf by Bart Wood
Js remote confJs remote conf
Js remote conf
Bart Wood130 views
Systems Integration in the Cloud Era, Kai Wähner MaibornWolff by CloudOps Summit
Systems Integration in the Cloud Era, Kai Wähner MaibornWolffSystems Integration in the Cloud Era, Kai Wähner MaibornWolff
Systems Integration in the Cloud Era, Kai Wähner MaibornWolff
CloudOps Summit497 views

Recently uploaded

Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
39 views1 slide
HTTP headers that make your website go faster - devs.gent November 2023 by
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023Thijs Feryn
22 views151 slides
Mini-Track: Challenges to Network Automation Adoption by
Mini-Track: Challenges to Network Automation AdoptionMini-Track: Challenges to Network Automation Adoption
Mini-Track: Challenges to Network Automation AdoptionNetwork Automation Forum
12 views27 slides
Melek BEN MAHMOUD.pdf by
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 views1 slide
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...James Anderson
85 views32 slides
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveNetwork Automation Forum
31 views35 slides

Recently uploaded(20)

Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn22 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson85 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software263 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada136 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi127 views
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta26 views

Kaazing

  • 1. Comet Never More! (HTML 5 WebSockets in Theory and Practice) Jonas Jacobi & John R. Fallows Founders Kaazing www.devoxx.com
  • 2. Speaker’s qualifications John and Jonas are founders of Kaazing, provider of the open sourcre HTML 5 Websocket gateway Both dudes are frequent writers for magazines such as JDJ, JavaMagazine, and AjaxWorld John and Jonas speak frequently at conferences World Wide on HTML 5 Communication Authors of Pro JSF and Ajax: Building Rich Internet Components 3 www.devoxx.com
  • 3. Overall Presentation Goal Learn how to architect and build full-duplex Web applications using HTML 5 communication www.devoxx.com
  • 4. If we were not restricted by the traditional limitations of HTTP, what type of Web applications would we build? www.devoxx.com
  • 5. DEMO Web Networking Usecases for Work and Play www.devoxx.com
  • 6. Agenda, or something … Part 1 – Comet and the Future Real-time Web Comet/Reverse Ajax HTML 5 Communication Break (30 minutes) Part 2 – Full-duplex Web Today Networking Review HTML 5 WebSockets Kaazing Gateway 7 www.devoxx.com
  • 7. Defining Real-Time Web Web Applications Typically Not Real-Time www.devoxx.com
  • 8. Defining Real-Time Web www.devoxx.com
  • 9. Defining Real-Time Web Or, is it just nearly, nearly real-time? www.devoxx.com
  • 10. Defining Real-Time Web Or, is it just nearly, nearly real-time? www.devoxx.com
  • 11. Ajax (XHR) Updates Limited To Preset Interval Message buffering increases memory usage Near real-time updates achieved with shorter intervals Shorter Updates Cause Increased network traffic Higher frequency connection setup & teardown www.devoxx.com
  • 12. Push Technology History Push technology has been around for a while: Pushlets (2002) Bang Networks (early adopter) Previous attempts failed, because: Scalability Limitations (Cost etc…) Not general purpose No standard www.devoxx.com
  • 13. Push Technology Server-Initiated Message Delivery Clients are listening Clients behind firewalls Techniques such as Comet/Reverse Ajax Delays Completion of HTTP Response Generally Implemented in JS www.devoxx.com
  • 14. Long Polling and Streaming Current Comet implementations center around two major areas: Long Polling Streaming www.devoxx.com
  • 15. Long Polling Also known as asynchronous-polling Request open for a set period HTTP headers often account for more than half of the network traffic www.devoxx.com
  • 16. Long Polling HTTP Request From client (browser) to server: GET /long-polling HTTP/1.1rn Host: www.kaazing.comrn User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9) Gecko/2008061017 Firefox/3.0rn Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8rn Accept-Language: en-us,en;q=0.5rn Accept-Encoding: gzip,deflatern Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7rn Keep-Alive: 300rn Connection: keep-alivern Cache-Control: max-age=0rn rn www.devoxx.com
  • 17. Long Polling HTTP Response From server to client (browser): Date: Tue, 16 Aug 2008 00:00:00 GMTrn Server: Apache/2.2.9 (Unix)rn Content-Type: text/plainrn Content-Length: 12rn rn Hello, world www.devoxx.com
  • 18. HTTP Streaming Persistent HTTP Connection Pending POST Minimizes Latency Reduction in Network Traffic Optimizes Connection Setup & Tear-Down Keep-alive Security www.devoxx.com
  • 19. Today’s Architecture Java EE Container RMI - JDBC - TCP (Full Duplex) TCP (Full Duplex) Database EJB Application Transport Logic IMAP - RMI TCP (Full Duplex) JavaMail IMAP Server Servlet JABBER - TCP (Full Duplex) IM Server HTTP Custom - Browser (Half Duplex) JMS - RMI TCP (Full Duplex) TCP (Full Duplex) JMS Stock Trading Client Stock JMS Trading Feed www.devoxx.com
  • 20. What’s Missing? Not a standard No true bi-directional communication No guaranteed message delivery Complex middle-tier architecture Adds unnecessary latency www.devoxx.com
  • 21. Evolving the Web Ajax Comet/Reverse Ajax WebSockets Server Server Server Connect Notify Notify Firewall Firewall Firewall Browser Browser Browser www.devoxx.com
  • 22. HTML 5 Overview Next generation application platform Communication (sockets, cross-site) Graphics (2D) Drag ‘n’ drop Storage (transient, persistent) Offline Compatibility www.devoxx.com
  • 23. HTML 5 WebSockets The Communication section: WebSockets Server-sent events Not New; TCPConnection API and protocol were initially drafted over two years ago www.devoxx.com
  • 24. HTML 5 Server-Sent Events Standardizes and formalizes how a continuous stream of data can be sent from a server to a browser Introduces eventsource—a new DOM element www.devoxx.com
  • 25. HTML 5 Server-Sent Events Connects to a server URL to receive an event stream: <eventsource src= quot;http:// stocks.kaazing.comquot; onmessage=quot;alert(event.data)quot;> www.devoxx.com
  • 26. HTML 5 Server-Sent Events Server can add the ID header so that clients add a Last-Event-ID header Used to guarantee message delivery Server specify an optional retry header as part of an event in the event stream www.devoxx.com
  • 27. HTML 5 WebSockets Defines full-duplex communications Operates over a single socket Traverses firewalls and routers seamlessly Allows authorized cross-domain communication Integrates with: Cookie-based authentication Existing HTTP load balancers www.devoxx.com
  • 28. HTML 5 WebSockets Connection established by upgrading from the HTTP protocol to the WebSocket protocol WebSocket data frames can be sent back and forth between the client and the server in full-duplex mode www.devoxx.com
  • 29. HTML 5 WebSockets Supports a diverse set of clients Cannot deliver raw binary data to JavaScript Binary data is ignored if the client is JavaScript Enables direct communication with backend systems www.devoxx.com
  • 30. HTML 5 WebSockets Detects presence of proxy servers A tunnel is established by issuing an HTTP CONNECT statement Secure Web sockets over SSL can leverage the same HTTP CONNECT technique www.devoxx.com
  • 31. Simplified Architecture RMI - Java EE JDBC - TCP (Full Duplex) TCP (Full Duplex) EJB RMI - TCP (Full Duplex) JMS Database WebSocket Server JDBC - TCP (Full Duplex) IMAP - TCP (Full Duplex) IMAP Server Jabber - TCP (Full Duplex) IM Server TCP over HTTP (Full Duplex) Browser Custom - TCP (Full Duplex) Stock Trading Feed www.devoxx.com
  • 32. HTML 5 WebSockets Creating a WebSocket instance: var myWebSocket = new WebSocket (“ws://www.websocket.org”); www.devoxx.com
  • 33. HTML 5 WebSockets Associating listeners: myWebSocket.onopen = function(evt) { alert(“Connection open ...”); }; myWebSocket.onmessage = function(evt) { alert( “Received Message: ” + evt.data); }; myWebSocket.onclose = function(evt) { alert(“Connection closed.”); }; www.devoxx.com
  • 34. HTML 5 WebSockets Sending messages: myWebSocket.postMessage(“Hello WebSocket!”); myWebSocket.postMessage(“Goodbye Comet!”); myWebSocket.disconnect(); www.devoxx.com
  • 35. HTML 5 WebSockets Enables full-duplex communication to any TCP-based back-end service: JMS Jabber Stomp etc… www.devoxx.com
  • 36. Stomp Protocol Simple Text-Oriented Messaging Protocol (STOMP) Publish and Subscribe Transactional Acknowledgements ActiveMQ, RabbitMQ, … www.devoxx.com
  • 37. Stomp Protocol var myStomp = new StompClient(); myStomp.onopen = function(headers) { myStomp.send(“Hello STOMP!”, “/topic/ destination”); } myStomp.onmessage = function(headers, body) { alert(body); } myStomp.connect(“ws://www.websocket.org/stomp”); myStomp.subscribe(destination.value); www.devoxx.com
  • 38. DEMO XMPP client www.devoxx.com
  • 39. HTML 5 – When?? 2022 AD (Not really) Opera already has Server Sent Events Mozilla/Firefox patch available – Bug 338583 Kaazing.org provides this NOW!!! IE 5.5+, Firefox 1.5+, Chrome 0.2+, Safari 3.1+, Opera 9.0+ 39 www.devoxx.com
  • 40. Summary Server-Sent Events standardize and formalize Comet/ Reverse Ajax WebSockets provides full-duplex communication Do I have to wait till 2022 AD? 40 www.devoxx.com
  • 42. Comet Never More! (HTML 5 WebSockets in Theory and Practice) John R. Fallows & Jonas Jacobi Founders Kaazing www.devoxx.com
  • 43. Agenda, or something … Part 1 – Comet and the Future Real-time Web Comet/Reverse Ajax HTML 5 Communication Break (30 minutes) Part 2 – Full-duplex Web Today Networking Review HTML 5 WebSockets Kaazing Gateway www.devoxx.com
  • 44. Networking Review Desktop Networking Full-duplex bidirectional TCP sockets Access any server on the network Browser Networking Half-duplex HTTP request-response HTTP polling, long polling, streaming Same-origin HTTP requests www.devoxx.com
  • 45. Half-Duplex Architecture Java EE Container RMI - JDBC - TCP (Full Duplex) TCP (Full Duplex) Database EJB Application Transport Logic IMAP - RMI TCP (Full Duplex) JavaMail IMAP Server Servlet JABBER - TCP (Full Duplex) IM Server HTTP Custom - Browser (Half Duplex) JMS - RMI TCP (Full Duplex) TCP (Full Duplex) JMS Stock Trading Client Stock JMS Trading Feed www.devoxx.com
  • 46. HTML 5 Communication WebSocket Proxy-friendly text socket for your browser Server-Sent Events Standardized HTTP streaming (downstream) Cross-Site XMLHttpRequest Secure cross-site remote communication postMessage Secure inter-iframe communication www.devoxx.com
  • 47. Full-duplex Architecture RMI - Java EE JDBC - TCP (Full Duplex) TCP (Full Duplex) EJB RMI - TCP (Full Duplex) JMS Database WebSocket Server JDBC - TCP (Full Duplex) IMAP - TCP (Full Duplex) IMAP Server Jabber - TCP (Full Duplex) IM Server TCP over HTTP (Full Duplex) Browser Custom - TCP (Full Duplex) Stock Trading Feed www.devoxx.com
  • 48. DEMO Java Messaging Service www.devoxx.com
  • 49. Kaazing Protocols Protocols ByteSocket WebSocket Server-Sent Events Cross-Site XHR postMessage IFrame XHR www.devoxx.com
  • 50. Kaazing ByteSocket Provides binary socket abstraction Leverages text-based WebSocket Encodes payload using base64 Send and receive ByteBuffers JavaScript has no byte or ByteArray type (yet) Kaazing Gateway converts base64 www.devoxx.com
  • 51. Kaazing ByteSocket var location = “ws://www.kaazing.org/binary”; var socket = new ByteSocket(location); socket.onmessage = function(event) { alert(event.data.getInt()); } var buf = new ByteBuffer(); buf.putString(“Hello, world”, Charset.UTF8); socket.postMessage(buf.flip()); www.devoxx.com
  • 52. Kaazing ByteSocket Protocols ByteSocket WebSocket Server-Sent Events Cross-Site XHR postMessage IFrame XHR www.devoxx.com
  • 53. HTML 5 WebSocket Provides Full-Duplex Text Socket Send and Receive Strings Enables Streaming to Server Too Browser Support None (yet) www.devoxx.com
  • 54. HTML 5 WebSocket Schemes ws://www.kaazing.org/text wss://www.kaazing.org/encrypted-text www.devoxx.com
  • 55. HTML 5 WebSocket API var location = “ws://www.kaazing.org/text”; var socket = new WebSocket(location); socket.onopen = function(event) { socket.send(“Hello, WebSocket”); } socket.onmessage = function(event) { alert(event.data); } socket.onclose = function(event) { alert(“closed”); } www.devoxx.com
  • 56. HTML 5 WebSocket Handshake GET /text HTTP/1.1rn Upgrade: WebSocketrn Connection: Upgradern Host: www.kaazing.orgrn …rn HTTP/1.1 101 WebSocket Protocol Handshakern Upgrade: WebSocketrn Connection: Upgradern …rn www.devoxx.com
  • 57. HTML 5 WebSocket Frames Frames can be sent full-duplex Either direction at any time Text Frames use terminator x80Hello, WebSocket0xff Binary Frames use length prefix x000x10Hello, WebSocket Text and binary frames on same WebSocket www.devoxx.com
  • 58. Kaazing WebSocket Protocols ByteSocket WebSocket Server-Sent Events Cross-Site XHR postMessage IFrame XHR www.devoxx.com
  • 59. HTML 5 Server-Sent Events www.devoxx.com
  • 60. HTML 5 Server-Sent Events HTML DOM Element <eventsource src=“http://www.kaazing.org/sse” onmessage=“alert(event.data)” > HTML DOM API var es = document.createElement(“eventsource”); es.addEventListener(“message”, function(event) { alert(event.data); }, false); es.addEventSource(“http://www.kaazing.org/ sse”); www.devoxx.com
  • 61. HTML 5 Server-Sent Events GET /sse HTTP/1.1rn Host: www.kaazing.orgrn Last-Event-ID: 9rn …rn 200 OK HTTP/1.1rn …rn :commentn id: 10n data: Hello, Server-Sent Eventsn n www.devoxx.com
  • 62. DEMO HTML 5 Server-Sent Events www.devoxx.com
  • 63. Kaazing Server-Sent Events Protocols ByteSocket WebSocket Server-Sent Events Cross-Site XHR postMessage IFrame XHR www.devoxx.com
  • 64. Cross-Site XMLHttpRequest W3C Technical Report Access Control for Cross-Site Requests Published Sept 12, 2008 http://www.w3.org/TR/access-control/ Browser Support Firefox 3.1-beta IE8 XDomainRequest (similar) Opera, Safari, Chrome coming www.devoxx.com
  • 65. Cross-Site XMLHttpRequest GET / HTTP/1.1rn Host: www.w3.orgrn Origin: http://www.kaazing.orgrn …rn 200 OK HTTP/1.1rn Allow-Origin: http://www.kaazing.orgrn …rn www.devoxx.com
  • 67. Kaazing Cross-Site XHR Protocols ByteSocket WebSocket Server-Sent Events Cross-Site XHR postMessage IFrame XHR www.devoxx.com
  • 68. HTML 5 postMessage Send Strings Between HTML Documents Documents may be served by different sites Standard API targetWindow.postMessage(message, targetOrigin) window.onmessage = function(event) { alert(event.data); } Browser Support IE 8, FF 3, Opera 9, WebKit nightlies www.devoxx.com
  • 69. DEMO HTML 5 postMessage www.devoxx.com
  • 70. Kaazing postMessage Protocols ByteSocket WebSocket Server-Sent Events Cross-Site XHR postMessage IFrame XHR www.devoxx.com
  • 71. Kaazing postMessage www.devoxx.com
  • 72. Kaazing Protocols Support Protocols ByteSocket WebSocket Server-Sent Events Cross-Site XHR postMessage IFrame XHR www.devoxx.com
  • 73. Kaazing Protocols Text or Binary Stomp XMPP IRC Telnet IMAP SMTP Custom… www.devoxx.com
  • 74. Kaazing Gateway Scalability Based on SEDA (Staged Event-Driven Architecture) Leverages Java New I/O (NIO) Concurrency Proportional to bandwidth not connections Latency Socket integration, bytes-in, bytes-out Stateless Minimal memory usage, balancing, failover www.devoxx.com
  • 75. Kaazing Gateway Security www.server.co IP Domain Name m Address stock.server.co Server m 65.43.2. Director chat.server.co 1 Firewall Gatewa m Public yDMZ y IP IP Server Addres Addres s: s: >|< Kaazing Gateway ldaps://directory.internal.net: 65.43.2 10.0.0. .1 1 Web Page tcp://gateway.dmz.net: http:// 8080 Cha www.server.com:80 t Firewall 636 Stock Stoc Serve k wss://stock.server.com: tcp://gateway.dmz.net: tcp://stock.internal.net : r 443 9090 61613 Browser Chat Serve r wss://chat.server.com:443 tcp://gateway.dmz.net: tcp://chat.internal.net:5222 9090 Public Internet DMZ Internal Network IP Addresses IP Addresses IP Addresses ! 10.0.0.0/24 10.0.0.0/24 192.168.0.0/16 ! 172.16.0.0/20 ! 192.168.0.0/16 www.devoxx.com
  • 76. Kaazing Enterprise Gateway Features Adobe Flex APIs Flash runtime detection EncryptedKeyring Single sign-on Protocol Validation Protocol Security Enhancements Management www.devoxx.com
  • 77. DEMO Kaazing XMPP Client www.devoxx.com
  • 78. Summary HTML 5 Communication is here WebSockets and SSE standardize Comet Avoid vendor lock-in, the standards shall set you free! Kaazing Community – www.kaazing.org 78 www.devoxx.com
  • 79. Concluding statement If HTTP did not restrict your creativity, what Web application would YOU create? www.devoxx.com
  • 80. Q&A www.devoxx.com
  • 81. Thanks for your attention! http://www.kaazing.org http://www.w3c.org www.devoxx.com