SlideShare a Scribd company logo
1 of 54
Download to read offline
Comet
 The Rise of Highly Interactive Websites




Joe Walker
DWR Lead Developer
Director, Support and Development, SitePen UK
Introduction
                                            Perspectives
                                              Technical
                                            Architectures


© SitePen, Inc. 2008. All Rights Reserved
Pushing data to the browser without
              needing the browser to ask




© SitePen, Inc. 2008. All Rights Reserved
Long lived HTTP (i.e. not polling)
                                        A pattern not a protocol
                                    Reverse Ajax == Comet + Polling




© SitePen, Inc. 2008. All Rights Reserved
© SitePen, Inc. 2008. All Rights Reserved
© SitePen, Inc. 2008. All Rights Reserved
Why now?




        Ajax made individual pages interactive

        The web is getting more social
                     == more transient




© SitePen, Inc. 2008. All Rights Reserved
Time people
                                                                spend on a
                                                                   page


                                                                    Time
                                                                   before a
                                                                     page
                                                                   changes

                                            Evolution of the Web


© SitePen, Inc. 2008. All Rights Reserved
Introduction
                                            Perspectives
                                              Technical
                                            Architectures


© SitePen, Inc. 2008. All Rights Reserved
Comet is for ...
                                              keeping me up to date
                                            ... with ...
                                              everyone else, and
                                              everything else



© SitePen, Inc. 2008. All Rights Reserved
Everyone else



        What are the other guys are doing?
               • Editing things that interest you
               • Talking to / about you
               • Saying and doing interesting things
               • Playing games




© SitePen, Inc. 2008. All Rights Reserved
Everything else




        What is System X doing?
               • Data streaming
               • Async processing
               • Transaction fulfillment




© SitePen, Inc. 2008. All Rights Reserved
Chat is everywhere: GMail, Meebo, Facebook ...
        Collaborative Editing: GDocs, Thinkature
        Streaming Financial Data: Lightstreamer, Caplin
        Asynch Updates: GMail, Yes.com
        Online Gaming: GPokr, Chess.com
        Async Server Processing: Polar Rose




© SitePen, Inc. 2008. All Rights Reserved
The web was designed connectionless
                            Comet gives you the connection back




© SitePen, Inc. 2008. All Rights Reserved
The web was designed
                                                  client-server

                                            Comet starts to make it look
                                              far more peer-to-peer




© SitePen, Inc. 2008. All Rights Reserved
Performance




© SitePen, Inc. 2008. All Rights Reserved
Introduction
                                            Perspectives
                                              Technical
                                            Architectures


© SitePen, Inc. 2008. All Rights Reserved
BUT
© SitePen, Inc. 2008. All Rights Reserved
Connection Options


        Long polling: XHR
        Forever Frame: iframe
        Script tags
        WebSockets
        ActiveXObject(“htmlfile”)
        Mime Messaging
        Flash Remoting


© SitePen, Inc. 2008. All Rights Reserved
Long Polling




        ‘Slow’ XHR request
        But:
               • Restart required
               • XHR.responseText on IE




© SitePen, Inc. 2008. All Rights Reserved
Client How-to: Forever Frame



        Open a slow iframe, poll for content
        IE lies about the content
               • Send text/plain + 4k whitespace to flush IE
               • Flush with <script> tag for each data block
        iframe needs restarting to avoid memory leak
        But IE clicks when iframe starts




© SitePen, Inc. 2008. All Rights Reserved
Client How-to: htmlfile

              ‘htmlfile’ is an ActiveX control like XHR:

              hf = new ActiveXObject(quot;htmlfilequot;);
              hf.open();
              hf.write(quot;<html><iframe/></html>quot;);
              hf.close();
              hf.parentWindow.dwr = dwr;


              Avoids ‘clicking’, but not IE/Server 2003
              Not supported in Firefox, Safari, Opera, etc.

© SitePen, Inc. 2008. All Rights Reserved
Client How-to: Callback Polling




        Dynamic <script> blocks
        Can point to any domain
        Does not stream




© SitePen, Inc. 2008. All Rights Reserved
Client How-to: Web Standards




        HTML 5 makes it better:
               • WebSockets
               • DOM Storage provides way to synchronize across tabs
                 and frames




© SitePen, Inc. 2008. All Rights Reserved
Other Options
             Mime Messaging
                   • Multipart Mime: x-multipart-replace
                   • Not IE
                   • Excellent performance
             Flash Remoting


© SitePen, Inc. 2008. All Rights Reserved
2 Connection Issue



        Coordination using:
               • window.name
               • cookies
        Multi-home DNS
        All modern browsers raise number of connections




© SitePen, Inc. 2008. All Rights Reserved
Other Issues




        HTTP streaming is download only (except WebSockets)
        Detection of failed connections




© SitePen, Inc. 2008. All Rights Reserved
Server Tricks


                         Stream-stoppers:
                                • Apache: mod_jk
                                • Buggy network proxies
                                • Application firewalls
                         Thread starvation (Servlet 3.0)
                         Multi-threading



© SitePen, Inc. 2008. All Rights Reserved
Does that stop us?




        So it’s a hack ...
         • But that hasn’t stopped Ajax
               • And Comet does work




© SitePen, Inc. 2008. All Rights Reserved
Library Solutions


        Open Solutions:
               • DWR http://directwebremoting.org
               • Jetty http://jetty.mortbay.org (Cometd)
               • Orbited http://orbited.org
               • Ice Faces http://icefaces.org
               • Atmosphere http://atmosphere.dev.java.net



© SitePen, Inc. 2008. All Rights Reserved
Comet vs. Polling



        For Polling:
               • More efficient for very low latencies
               • Simpler to implement
        For Comet:
               • More efficient in general case
               • More adaptable




© SitePen, Inc. 2008. All Rights Reserved
Introduction
                                            Perspectives
                                              Technical
                                            Architectures


© SitePen, Inc. 2008. All Rights Reserved
Inboard vs Outboard



© SitePen, Inc. 2008. All Rights Reserved
Inboard Comet




                                            Comet is part of the main
                                            web server infrastructure




© SitePen, Inc. 2008. All Rights Reserved
Inboard (e.g. DWR)




               • Simpler for new development
               • Harder scaling
               • Comet is just part of the infrastructure




© SitePen, Inc. 2008. All Rights Reserved
Outboard (e.g. Cometd)




                                            Comet is deployed to a
                                            separate set of servers




© SitePen, Inc. 2008. All Rights Reserved
Outboard (e.g. Cometd)




               • Add-on that doesn’t affect the server
               • Easier to add to existing apps
               • Harder to get started




© SitePen, Inc. 2008. All Rights Reserved
API Styles:



© SitePen, Inc. 2008. All Rights Reserved
API Styles:
                                            Level 0: P2P Data



© SitePen, Inc. 2008. All Rights Reserved
Level 0: P2P Data with WebSocket



                  var s = new WebSocket(quot;ws://eg.com/demoquot;);

                  s.onOpen = function(e) { alert(quot;Openquot;); }
                  s.onRead = function(e) { alert(e.data); }
                  s.onClose = function(e) { alert(quot;Closequot;); }

                  s.send(quot;Hello Worldquot;);




© SitePen, Inc. 2008. All Rights Reserved
API Styles:
                                            Level 1: Pub / Sub



© SitePen, Inc. 2008. All Rights Reserved
Level 1: Pub/Sub with Bayeux / Jetty

                  // Bayeux Example
                  // Get a channel
                  dojox.cometd.Channel c =
                       bayeux.getChannel(chanName, true);

                  // Subscribe to things published
                  c.subscribe(client);

                  // Publish something ourselves
                  c.publish(fromClient, data, msgId);




© SitePen, Inc. 2008. All Rights Reserved
Level 1: Pub/Sub with Atmosphere

                  @Grizzlet(Grizzlet.Scope.APPLICATION)
                  @Path(quot;myGrizzletquot;)
                  public class MyGrizzlet {
                    @Broadcaster(Grizzlet.Scope.VM)
                    private Broadcaster bc;
                    @Suspend(6000) @GET @Push
                    public String onGet() {
                      bc.brodcast(quot;New userquot;);
                      return quot;Suspending the connectionquot;;
                    }
                  }



© SitePen, Inc. 2008. All Rights Reserved
Pub / Sub Advantages




               • Low coupling
               • Inter-language interoperability




© SitePen, Inc. 2008. All Rights Reserved
API Styles:
                                            Level 2: API Based



© SitePen, Inc. 2008. All Rights Reserved
Level 2: API Based



                  <span id=quot;pricequot;></span>

                  <script>
                    dwr.util.setValue(quot;pricequot;, 42);
                  </script>




© SitePen, Inc. 2008. All Rights Reserved
Level 2: API Based



                  <span id=quot;pricequot;></span>

                  // on the server
                  import org.directwebremoting.ui.dwr.Util;
                  Util.setValue(quot;pricequot;, 42);




© SitePen, Inc. 2008. All Rights Reserved
Level 2: API Based



                  <span id=quot;pricequot;></span>

                  // on the server
                  import org....scriptaculous.Effect;
                  Effect.shake(quot;pricequot;);




© SitePen, Inc. 2008. All Rights Reserved
Level 2: API Based



                  import org.dojotoolkit.dijit.Dijit;
                  import org.dojotoolkit.dijit.Editor;

                  Editor e = Dijit.byId(quot;pricequot;,Editor.class);
                  e.setValue(42);




© SitePen, Inc. 2008. All Rights Reserved
Level 2: API Based




               • Tighter coupling
               • Richer API




© SitePen, Inc. 2008. All Rights Reserved
API Styles:
                 Level 3: Data Sync Based



© SitePen, Inc. 2008. All Rights Reserved
Level 3: Data Sync API




                  dataStore.add(person);




© SitePen, Inc. 2008. All Rights Reserved
Level 3: Data Sync Based




               • Trivial to understand
               • Enables smart network control
               • Very hard to get 100%




© SitePen, Inc. 2008. All Rights Reserved
Comet
          The Rise of Highly Interactive Websites

                              http://directwebremoting.org/
                                  http://cometdaily.org/
                                    http://sitepen.com/



© SitePen, Inc. 2008. All Rights Reserved

More Related Content

What's hot

Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Bruno Borges
 
London Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesLondon Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesStrangeloop
 
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch
 
soft-shake.ch - Introduction to HTML5
soft-shake.ch - Introduction to HTML5soft-shake.ch - Introduction to HTML5
soft-shake.ch - Introduction to HTML5soft-shake.ch
 
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]Aaron Gustafson
 
Aplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansAplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansBruno Borges
 
HTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun GuptaHTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun GuptaJAX London
 

What's hot (7)

Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7
 
London Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesLondon Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companies
 
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
 
soft-shake.ch - Introduction to HTML5
soft-shake.ch - Introduction to HTML5soft-shake.ch - Introduction to HTML5
soft-shake.ch - Introduction to HTML5
 
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
 
Aplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansAplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeans
 
HTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun GuptaHTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun Gupta
 

Viewers also liked

Scaling Crashlytics: Building Analytics on Redis 2.6
Scaling Crashlytics: Building Analytics on Redis 2.6Scaling Crashlytics: Building Analytics on Redis 2.6
Scaling Crashlytics: Building Analytics on Redis 2.6Crashlytics
 
High-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using RedisHigh-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using Rediscacois
 
Building Effective Compensation Plans
Building Effective Compensation PlansBuilding Effective Compensation Plans
Building Effective Compensation PlansCallidus Software
 
Pc Mplayer
Pc MplayerPc Mplayer
Pc Mplayerkumee
 
Defending Your Workloads Against the Next Zero-Day Vulnerability
Defending Your Workloads Against the Next Zero-Day VulnerabilityDefending Your Workloads Against the Next Zero-Day Vulnerability
Defending Your Workloads Against the Next Zero-Day VulnerabilityAmazon Web Services
 
Accelerating DevOps Pipelines with AWS
Accelerating DevOps Pipelines with AWS Accelerating DevOps Pipelines with AWS
Accelerating DevOps Pipelines with AWS Amazon Web Services
 
Disaster Recovery of on-premises IT infrastructure with AWS
Disaster Recovery of on-premises IT infrastructure with AWSDisaster Recovery of on-premises IT infrastructure with AWS
Disaster Recovery of on-premises IT infrastructure with AWSAmazon Web Services
 
Alessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet GovernanceAlessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet GovernanceAndrea Rossetti
 
Gp Parki Narodowe
Gp Parki NarodoweGp Parki Narodowe
Gp Parki Narodowebeowulf
 
The Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested LandscapeThe Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested LandscapeAlan Doherty
 
Living Labs for Territorial Innovation
Living Labs for Territorial InnovationLiving Labs for Territorial Innovation
Living Labs for Territorial Innovationjexxon
 
Gianluigi Viscusi, Libertà e pluralismo dei valori II
Gianluigi Viscusi, Libertà e pluralismo dei valori IIGianluigi Viscusi, Libertà e pluralismo dei valori II
Gianluigi Viscusi, Libertà e pluralismo dei valori IIAndrea Rossetti
 
Providing Better Producer Administration With TrueProducer
Providing Better Producer Administration With TrueProducerProviding Better Producer Administration With TrueProducer
Providing Better Producer Administration With TrueProducerCallidus Software
 
07 ZamyšLení Tantra Totem
07  ZamyšLení  Tantra Totem07  ZamyšLení  Tantra Totem
07 ZamyšLení Tantra Totemjedlickak07
 

Viewers also liked (20)

Scaling Crashlytics: Building Analytics on Redis 2.6
Scaling Crashlytics: Building Analytics on Redis 2.6Scaling Crashlytics: Building Analytics on Redis 2.6
Scaling Crashlytics: Building Analytics on Redis 2.6
 
High-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using RedisHigh-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using Redis
 
Building Effective Compensation Plans
Building Effective Compensation PlansBuilding Effective Compensation Plans
Building Effective Compensation Plans
 
Pc Mplayer
Pc MplayerPc Mplayer
Pc Mplayer
 
Defending Your Workloads Against the Next Zero-Day Vulnerability
Defending Your Workloads Against the Next Zero-Day VulnerabilityDefending Your Workloads Against the Next Zero-Day Vulnerability
Defending Your Workloads Against the Next Zero-Day Vulnerability
 
Vergani, RGW 2011 1
Vergani, RGW 2011 1Vergani, RGW 2011 1
Vergani, RGW 2011 1
 
Accelerating DevOps Pipelines with AWS
Accelerating DevOps Pipelines with AWS Accelerating DevOps Pipelines with AWS
Accelerating DevOps Pipelines with AWS
 
Stuff
StuffStuff
Stuff
 
Disaster Recovery of on-premises IT infrastructure with AWS
Disaster Recovery of on-premises IT infrastructure with AWSDisaster Recovery of on-premises IT infrastructure with AWS
Disaster Recovery of on-premises IT infrastructure with AWS
 
WLCG-Discu
WLCG-DiscuWLCG-Discu
WLCG-Discu
 
Alessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet GovernanceAlessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet Governance
 
Gp Parki Narodowe
Gp Parki NarodoweGp Parki Narodowe
Gp Parki Narodowe
 
The Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested LandscapeThe Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested Landscape
 
Living Labs for Territorial Innovation
Living Labs for Territorial InnovationLiving Labs for Territorial Innovation
Living Labs for Territorial Innovation
 
Bizimkusak
BizimkusakBizimkusak
Bizimkusak
 
Watts Happening
Watts HappeningWatts Happening
Watts Happening
 
Comete
CometeComete
Comete
 
Gianluigi Viscusi, Libertà e pluralismo dei valori II
Gianluigi Viscusi, Libertà e pluralismo dei valori IIGianluigi Viscusi, Libertà e pluralismo dei valori II
Gianluigi Viscusi, Libertà e pluralismo dei valori II
 
Providing Better Producer Administration With TrueProducer
Providing Better Producer Administration With TrueProducerProviding Better Producer Administration With TrueProducer
Providing Better Producer Administration With TrueProducer
 
07 ZamyšLení Tantra Totem
07  ZamyšLení  Tantra Totem07  ZamyšLení  Tantra Totem
07 ZamyšLení Tantra Totem
 

Similar to The Rise of Highly Interactive Websites with Comet Technology

Comet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyComet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyBrian Moschel
 
HTML5 WebSocket Introduction
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket IntroductionMarcelo Jabali
 
Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008Cybera Inc.
 
Deploying in the Cloud: Why and How
Deploying in the Cloud: Why and HowDeploying in the Cloud: Why and How
Deploying in the Cloud: Why and HowMatt Small
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
 
Gregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle WareGregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle Waredeimos
 
Search Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black MagicSearch Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black Magicguestb1f3a
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developerslisab517
 
Openwebdylanqconbeijing 090423091545-phpapp01
Openwebdylanqconbeijing 090423091545-phpapp01Openwebdylanqconbeijing 090423091545-phpapp01
Openwebdylanqconbeijing 090423091545-phpapp01youzitang
 
Sitepen Getting There From Here
Sitepen   Getting There From HereSitepen   Getting There From Here
Sitepen Getting There From HereGeorge Ang
 
Belgium.be - The new Belgian government portal, a catalyst for more user-cent...
Belgium.be - The new Belgian government portal, a catalyst for more user-cent...Belgium.be - The new Belgian government portal, a catalyst for more user-cent...
Belgium.be - The new Belgian government portal, a catalyst for more user-cent...Filip Borloo
 
Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4Juan Sanchez
 
Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...
Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...
Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...Compuware APM
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)Peter Lubbers
 
Building and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on RailsBuilding and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on RailsViget Labs
 
What's new in DWR version 3
What's new in DWR version 3What's new in DWR version 3
What's new in DWR version 3Joe Walker
 
Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014Frank Greco
 
RESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs FictionRESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs FictionSubbu Allamaraju
 
One Unified Platform for Deploying Enterprise Class Solutions across any ente...
One Unified Platform for Deploying Enterprise Class Solutions across any ente...One Unified Platform for Deploying Enterprise Class Solutions across any ente...
One Unified Platform for Deploying Enterprise Class Solutions across any ente...trw188
 

Similar to The Rise of Highly Interactive Websites with Comet Technology (20)

Comet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyComet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called Jabbify
 
HTML5 WebSocket Introduction
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket Introduction
 
Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008
 
Deploying in the Cloud: Why and How
Deploying in the Cloud: Why and HowDeploying in the Cloud: Why and How
Deploying in the Cloud: Why and How
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
Gregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle WareGregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle Ware
 
Search Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black MagicSearch Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black Magic
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developers
 
Openwebdylanqconbeijing 090423091545-phpapp01
Openwebdylanqconbeijing 090423091545-phpapp01Openwebdylanqconbeijing 090423091545-phpapp01
Openwebdylanqconbeijing 090423091545-phpapp01
 
Sitepen Getting There From Here
Sitepen   Getting There From HereSitepen   Getting There From Here
Sitepen Getting There From Here
 
Belgium.be - The new Belgian government portal, a catalyst for more user-cent...
Belgium.be - The new Belgian government portal, a catalyst for more user-cent...Belgium.be - The new Belgian government portal, a catalyst for more user-cent...
Belgium.be - The new Belgian government portal, a catalyst for more user-cent...
 
Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4
 
Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...
Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...
Achieving Peak User Experiences & Optimizing Web Performance - Load Testing, ...
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
 
Building and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on RailsBuilding and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on Rails
 
What's new in DWR version 3
What's new in DWR version 3What's new in DWR version 3
What's new in DWR version 3
 
Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014
 
RESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs FictionRESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs Fiction
 
XTech May 2008
XTech May 2008XTech May 2008
XTech May 2008
 
One Unified Platform for Deploying Enterprise Class Solutions across any ente...
One Unified Platform for Deploying Enterprise Class Solutions across any ente...One Unified Platform for Deploying Enterprise Class Solutions across any ente...
One Unified Platform for Deploying Enterprise Class Solutions across any ente...
 

Recently uploaded

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessWSO2
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sectoritnewsafrica
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 

Recently uploaded (20)

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 

The Rise of Highly Interactive Websites with Comet Technology

  • 1. Comet The Rise of Highly Interactive Websites Joe Walker DWR Lead Developer Director, Support and Development, SitePen UK
  • 2. Introduction Perspectives Technical Architectures © SitePen, Inc. 2008. All Rights Reserved
  • 3. Pushing data to the browser without needing the browser to ask © SitePen, Inc. 2008. All Rights Reserved
  • 4. Long lived HTTP (i.e. not polling) A pattern not a protocol Reverse Ajax == Comet + Polling © SitePen, Inc. 2008. All Rights Reserved
  • 5. © SitePen, Inc. 2008. All Rights Reserved
  • 6. © SitePen, Inc. 2008. All Rights Reserved
  • 7. Why now? Ajax made individual pages interactive The web is getting more social == more transient © SitePen, Inc. 2008. All Rights Reserved
  • 8. Time people spend on a page Time before a page changes Evolution of the Web © SitePen, Inc. 2008. All Rights Reserved
  • 9. Introduction Perspectives Technical Architectures © SitePen, Inc. 2008. All Rights Reserved
  • 10. Comet is for ... keeping me up to date ... with ... everyone else, and everything else © SitePen, Inc. 2008. All Rights Reserved
  • 11. Everyone else What are the other guys are doing? • Editing things that interest you • Talking to / about you • Saying and doing interesting things • Playing games © SitePen, Inc. 2008. All Rights Reserved
  • 12. Everything else What is System X doing? • Data streaming • Async processing • Transaction fulfillment © SitePen, Inc. 2008. All Rights Reserved
  • 13. Chat is everywhere: GMail, Meebo, Facebook ... Collaborative Editing: GDocs, Thinkature Streaming Financial Data: Lightstreamer, Caplin Asynch Updates: GMail, Yes.com Online Gaming: GPokr, Chess.com Async Server Processing: Polar Rose © SitePen, Inc. 2008. All Rights Reserved
  • 14. The web was designed connectionless Comet gives you the connection back © SitePen, Inc. 2008. All Rights Reserved
  • 15. The web was designed client-server Comet starts to make it look far more peer-to-peer © SitePen, Inc. 2008. All Rights Reserved
  • 16. Performance © SitePen, Inc. 2008. All Rights Reserved
  • 17. Introduction Perspectives Technical Architectures © SitePen, Inc. 2008. All Rights Reserved
  • 18. BUT © SitePen, Inc. 2008. All Rights Reserved
  • 19. Connection Options Long polling: XHR Forever Frame: iframe Script tags WebSockets ActiveXObject(“htmlfile”) Mime Messaging Flash Remoting © SitePen, Inc. 2008. All Rights Reserved
  • 20. Long Polling ‘Slow’ XHR request But: • Restart required • XHR.responseText on IE © SitePen, Inc. 2008. All Rights Reserved
  • 21. Client How-to: Forever Frame Open a slow iframe, poll for content IE lies about the content • Send text/plain + 4k whitespace to flush IE • Flush with <script> tag for each data block iframe needs restarting to avoid memory leak But IE clicks when iframe starts © SitePen, Inc. 2008. All Rights Reserved
  • 22. Client How-to: htmlfile ‘htmlfile’ is an ActiveX control like XHR: hf = new ActiveXObject(quot;htmlfilequot;); hf.open(); hf.write(quot;<html><iframe/></html>quot;); hf.close(); hf.parentWindow.dwr = dwr; Avoids ‘clicking’, but not IE/Server 2003 Not supported in Firefox, Safari, Opera, etc. © SitePen, Inc. 2008. All Rights Reserved
  • 23. Client How-to: Callback Polling Dynamic <script> blocks Can point to any domain Does not stream © SitePen, Inc. 2008. All Rights Reserved
  • 24. Client How-to: Web Standards HTML 5 makes it better: • WebSockets • DOM Storage provides way to synchronize across tabs and frames © SitePen, Inc. 2008. All Rights Reserved
  • 25. Other Options Mime Messaging • Multipart Mime: x-multipart-replace • Not IE • Excellent performance Flash Remoting © SitePen, Inc. 2008. All Rights Reserved
  • 26. 2 Connection Issue Coordination using: • window.name • cookies Multi-home DNS All modern browsers raise number of connections © SitePen, Inc. 2008. All Rights Reserved
  • 27. Other Issues HTTP streaming is download only (except WebSockets) Detection of failed connections © SitePen, Inc. 2008. All Rights Reserved
  • 28. Server Tricks Stream-stoppers: • Apache: mod_jk • Buggy network proxies • Application firewalls Thread starvation (Servlet 3.0) Multi-threading © SitePen, Inc. 2008. All Rights Reserved
  • 29. Does that stop us? So it’s a hack ... • But that hasn’t stopped Ajax • And Comet does work © SitePen, Inc. 2008. All Rights Reserved
  • 30. Library Solutions Open Solutions: • DWR http://directwebremoting.org • Jetty http://jetty.mortbay.org (Cometd) • Orbited http://orbited.org • Ice Faces http://icefaces.org • Atmosphere http://atmosphere.dev.java.net © SitePen, Inc. 2008. All Rights Reserved
  • 31. Comet vs. Polling For Polling: • More efficient for very low latencies • Simpler to implement For Comet: • More efficient in general case • More adaptable © SitePen, Inc. 2008. All Rights Reserved
  • 32. Introduction Perspectives Technical Architectures © SitePen, Inc. 2008. All Rights Reserved
  • 33. Inboard vs Outboard © SitePen, Inc. 2008. All Rights Reserved
  • 34. Inboard Comet Comet is part of the main web server infrastructure © SitePen, Inc. 2008. All Rights Reserved
  • 35. Inboard (e.g. DWR) • Simpler for new development • Harder scaling • Comet is just part of the infrastructure © SitePen, Inc. 2008. All Rights Reserved
  • 36. Outboard (e.g. Cometd) Comet is deployed to a separate set of servers © SitePen, Inc. 2008. All Rights Reserved
  • 37. Outboard (e.g. Cometd) • Add-on that doesn’t affect the server • Easier to add to existing apps • Harder to get started © SitePen, Inc. 2008. All Rights Reserved
  • 38. API Styles: © SitePen, Inc. 2008. All Rights Reserved
  • 39. API Styles: Level 0: P2P Data © SitePen, Inc. 2008. All Rights Reserved
  • 40. Level 0: P2P Data with WebSocket var s = new WebSocket(quot;ws://eg.com/demoquot;); s.onOpen = function(e) { alert(quot;Openquot;); } s.onRead = function(e) { alert(e.data); } s.onClose = function(e) { alert(quot;Closequot;); } s.send(quot;Hello Worldquot;); © SitePen, Inc. 2008. All Rights Reserved
  • 41. API Styles: Level 1: Pub / Sub © SitePen, Inc. 2008. All Rights Reserved
  • 42. Level 1: Pub/Sub with Bayeux / Jetty // Bayeux Example // Get a channel dojox.cometd.Channel c = bayeux.getChannel(chanName, true); // Subscribe to things published c.subscribe(client); // Publish something ourselves c.publish(fromClient, data, msgId); © SitePen, Inc. 2008. All Rights Reserved
  • 43. Level 1: Pub/Sub with Atmosphere @Grizzlet(Grizzlet.Scope.APPLICATION) @Path(quot;myGrizzletquot;) public class MyGrizzlet { @Broadcaster(Grizzlet.Scope.VM) private Broadcaster bc; @Suspend(6000) @GET @Push public String onGet() { bc.brodcast(quot;New userquot;); return quot;Suspending the connectionquot;; } } © SitePen, Inc. 2008. All Rights Reserved
  • 44. Pub / Sub Advantages • Low coupling • Inter-language interoperability © SitePen, Inc. 2008. All Rights Reserved
  • 45. API Styles: Level 2: API Based © SitePen, Inc. 2008. All Rights Reserved
  • 46. Level 2: API Based <span id=quot;pricequot;></span> <script> dwr.util.setValue(quot;pricequot;, 42); </script> © SitePen, Inc. 2008. All Rights Reserved
  • 47. Level 2: API Based <span id=quot;pricequot;></span> // on the server import org.directwebremoting.ui.dwr.Util; Util.setValue(quot;pricequot;, 42); © SitePen, Inc. 2008. All Rights Reserved
  • 48. Level 2: API Based <span id=quot;pricequot;></span> // on the server import org....scriptaculous.Effect; Effect.shake(quot;pricequot;); © SitePen, Inc. 2008. All Rights Reserved
  • 49. Level 2: API Based import org.dojotoolkit.dijit.Dijit; import org.dojotoolkit.dijit.Editor; Editor e = Dijit.byId(quot;pricequot;,Editor.class); e.setValue(42); © SitePen, Inc. 2008. All Rights Reserved
  • 50. Level 2: API Based • Tighter coupling • Richer API © SitePen, Inc. 2008. All Rights Reserved
  • 51. API Styles: Level 3: Data Sync Based © SitePen, Inc. 2008. All Rights Reserved
  • 52. Level 3: Data Sync API dataStore.add(person); © SitePen, Inc. 2008. All Rights Reserved
  • 53. Level 3: Data Sync Based • Trivial to understand • Enables smart network control • Very hard to get 100% © SitePen, Inc. 2008. All Rights Reserved
  • 54. Comet The Rise of Highly Interactive Websites http://directwebremoting.org/ http://cometdaily.org/ http://sitepen.com/ © SitePen, Inc. 2008. All Rights Reserved