SlideShare una empresa de Scribd logo
1 de 60
Descargar para leer sin conexión
Comet ☄
The Rise of Highly Interactive Web Sites
Introduction

Perspectives on Comet

blabberone.sitepen.com

Architectures

Technical
Long lived HTTP

   A pattern not a protocol

     Distinct from polling

Reverse Ajax == Comet + Polling
Pushing data to the
browser without needing
   the browser to ask
Why?


Ajax made individual pages interactive places to
explore
More and more of the data on the web is social
and therefore changing
Why?
                   Time people
                    spend on a
                       page




                       Time before
                          a page
                         changes



Evolution of the Web
Time
                      Server




     Ajax
  Interaction


        Time
                           Server




Comet Updates State
Perspectives
Comet is for ...
   • keeping me up to date
... with ...
   • everyone else, and
   • everything else
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
Everything else

What is System X doing?
  • Data streaming
  • Async processing
  • Transaction fulfillment
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
Before comet,
 services were one way.
Now services can talk back
Async made easy

  • fire and forget
  • growl/toast for the web
Programming model changes:

  • Waiter vs. Buffet
  • The server is an event bus
  • State changes are events!
Changing the user
   experience
Architectures
Inboard vs Outboard
App Server
App Server
App Server
App Server
App Server
App Server
Inboard (e.g. DWR)

   • Simpler for new development
   • Harder scaling
   • Comet is just part of the infrastructure
CometD
         App Server
CometD
         App Server
CometD
         App Server
CometD
         App Server
CometD
         App Server
CometD
         App Server
CometD
         App Server
Outboard (e.g. Cometd):

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

share.html

<p>Share price:
 <span id='price'>
 </span>
</p>
On the Client        On the Server

share.html

<p>Share price:
                     import org.directwebremoting.ui.dwr.Util;
 <span id='price'>
 </span>
                     Util.setValue(quot;pricequot;, 42);
</p>
On the Client        On the Server

share.html

<p>Share price:      import org....scriptaculous.Effect
 <span id='price'>
 </span>             Effect.shake(quot;pricequot;);
</p>
On the Client        On the Server

share.html

<p>Share price:      import jsx3.gui.*
 <span id='price'>
 </span>             Server s = GI.getServer(quot;appquot;);
</p>                 Button b = s.getJSXById(quot;idquot;, Button.class);
                     b.setEnabled(Form.STATEDISABLED, true);
On the Client        On the Server

share.html

<p>Share price:      import org.dojotoolkit.dijit.Dijit;
 <span id='price'>   import org.dojotoolkit.dijit.Editor;
 </span>
</p>                 Editor e = Dijit.byId(quot;pricequot;, Editor.class);
                     e.setValue(42);
On the Client        On the Server

share.html           ScriptSessionFilter f = ...;

<p>Share price:      Runnable r = new Runnable() {
 <span id='price'>      public void run() {
 </span>                   ...
</p>                     }
                     };

                     Browser.withAllSessionsFiltered(f, r);
On the Client        On the Server

share.html
                     String s = quot;dwr.util.setValue('price', 42)quot;;
<p>Share price:      ScriptBuffer b = new ScriptBuffer(s);
 <span id='price'>
 </span>             for (ScriptSession session : sessions) {
</p>                   session.addScript(b);
                     }
On the Client        On the Server

share.html

<p>Share price:
 <span id='price'>
 </span>
</p>
Diagrams
Bayeux Performance
Client             Server    Client               Server   Client           Server




                                                                    Time
                                       Time
         Time




         Polling                      Long Poll                 Forever Frame


                            Load Profiles
client one                               client one



         client two                               client two




                                                               comet
                      ajax
           ajax




                                                       ajax
                      request handler                                  request handler

                             app logic                                       app logic



                             database                                       database
server                                   server


                  Time                                        Time
But ...



It’s a hack ... for now
Client Issues
Maximum of 2 connections per browser per host (IE7/6)
   • Coordination using window.name in the client
   • or cookies using a server
   • or use multi-home DNS
HTTP streaming is download only (chunked mode)
TCP connections are kept alive under HTTP 1.1
Server detection of failed connections
Not A Hack Much Longer

New browsers will make it better:
   • IE 8, FF3 raise number of connections
   • HTML 5 event sources
     • Opera already implements
   • HTML 5 DOM Storage provides way to
     synchronize across tabs and frames
Client How-to: Forever
            Frame
Client posts an iframe which doesn’t close quickly
   • Send text/plain and poll in browser (not IE)
   • Send text/plain with 4k whitespace to flush IE
   • Flush with a <script> tag for each data block
The iframe will need killing and restarting to avoid
memory leak
But IE clicks when iframe starts
Client How-to: Long Polling

Client makes an XHR request which does not
return immediately
IE disallows reading XHR.responseText until
connection is closed
Although you can keep XHR frames open
forever, generally you poll
Client How-to: htmlfile
‘htmlfile’ is an ActiveX control like XHR:
 htmlfile = new ActiveXObject(quot;htmlfilequot;);
 htmlfile.open();
 htmlfile.write(quot;<html><iframe
src='javascript:void(0)'
     onload='cleanup();'></iframe></html>quot;);
 htmlfile.close();
 htmlfile.parentWindow.dwr = dwr;

Avoids ‘clicking’, but doesn’t work in IE/Server 2003
Not supported in Firefox, Safari, Opera, etc.
Client How-to: Callback
           Polling


Create <script> blocks pointing to any domain
Create new script block when last completes
Client How-to: Other Options

Mime Messaging:
    • Uses Multipart Mime in HTML: x-multipart-replace
    • Not in IE
    • Excellent performance
Server-Sent Events: WHATWG, but Opera only
Flash: We probably have enough other options that we don’t
need to get into plugins
Server Tricks

Watch out for stream-stoppers
   • Apache: mod_jk
   • Buggy network proxies
   • Various application firewalls
Watch out for thread starvation
Does that stop us?


Ajax is also a hack, but that hasn’t stopped it
And Comet does work
Comet vs. Polling
For Polling:
   • More efficient for very low latencies
   • Simpler to implement
For Comet:
   • More efficient for all but very low latencies
   • More adaptable

Más contenido relacionado

La actualidad más candente

Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?timbc
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCLFastly
 
HTML5 Server Sent Events/JSF JAX 2011 Conference
HTML5 Server Sent Events/JSF  JAX 2011 ConferenceHTML5 Server Sent Events/JSF  JAX 2011 Conference
HTML5 Server Sent Events/JSF JAX 2011 ConferenceRoger Kitain
 
0-60 with Goliath: Building High Performance Ruby Web-Services
0-60 with Goliath: Building High Performance Ruby Web-Services0-60 with Goliath: Building High Performance Ruby Web-Services
0-60 with Goliath: Building High Performance Ruby Web-ServicesIlya Grigorik
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellSalaudeen Rajack
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsi krishna
 
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST ServicesEWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST ServicesRob Tweed
 
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...Rob Tweed
 
Using Websockets in Play !
Using Websockets in Play !Using Websockets in Play !
Using Websockets in Play !Knoldus Inc.
 
Pushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax WPushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax Wrajivmordani
 
Symfony2 Components - The Event Dispatcher
Symfony2 Components - The Event DispatcherSymfony2 Components - The Event Dispatcher
Symfony2 Components - The Event DispatcherSarah El-Atm
 
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Using Node.js to  Build Great  Streaming Services - HTML5 Dev ConfUsing Node.js to  Build Great  Streaming Services - HTML5 Dev Conf
Using Node.js to Build Great Streaming Services - HTML5 Dev ConfTom Croucher
 

La actualidad más candente (20)

Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
HTML5 Server Sent Events/JSF JAX 2011 Conference
HTML5 Server Sent Events/JSF  JAX 2011 ConferenceHTML5 Server Sent Events/JSF  JAX 2011 Conference
HTML5 Server Sent Events/JSF JAX 2011 Conference
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
0-60 with Goliath: Building High Performance Ruby Web-Services
0-60 with Goliath: Building High Performance Ruby Web-Services0-60 with Goliath: Building High Performance Ruby Web-Services
0-60 with Goliath: Building High Performance Ruby Web-Services
 
Time for Comet?
Time for Comet?Time for Comet?
Time for Comet?
 
Server side
Server sideServer side
Server side
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Html5 security
Html5 securityHtml5 security
Html5 security
 
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST ServicesEWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
 
Web sockets in Java
Web sockets in JavaWeb sockets in Java
Web sockets in Java
 
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
 
Using Websockets in Play !
Using Websockets in Play !Using Websockets in Play !
Using Websockets in Play !
 
Pushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax WPushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax W
 
Symfony2 Components - The Event Dispatcher
Symfony2 Components - The Event DispatcherSymfony2 Components - The Event Dispatcher
Symfony2 Components - The Event Dispatcher
 
SERVIET
SERVIETSERVIET
SERVIET
 
WebSockets with Spring 4
WebSockets with Spring 4WebSockets with Spring 4
WebSockets with Spring 4
 
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Using Node.js to  Build Great  Streaming Services - HTML5 Dev ConfUsing Node.js to  Build Great  Streaming Services - HTML5 Dev Conf
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
 

Destacado

07 ZamyšLení ČTyřI SvíčKy
07  ZamyšLení ČTyřI SvíčKy07  ZamyšLení ČTyřI SvíčKy
07 ZamyšLení ČTyřI SvíčKyjedlickak07
 
Silverlight Ux Talk External
Silverlight Ux Talk ExternalSilverlight Ux Talk External
Silverlight Ux Talk ExternalMartha Rotter
 
New Media Addicts Anonymous
New Media Addicts AnonymousNew Media Addicts Anonymous
New Media Addicts AnonymousGeert Wissink
 
Knooppuntcafé Roparun Team 296 Beeld en Geluid
Knooppuntcafé Roparun Team 296 Beeld en GeluidKnooppuntcafé Roparun Team 296 Beeld en Geluid
Knooppuntcafé Roparun Team 296 Beeld en GeluidGeert Wissink
 
Multiplatform & Multiscreen Ecosystem
Multiplatform & Multiscreen EcosystemMultiplatform & Multiscreen Ecosystem
Multiplatform & Multiscreen EcosystemBertram Gugel
 
Finding Simple - Seat Map Design for Everyone UX Australia 2014
Finding Simple - Seat Map Design for Everyone  UX Australia 2014Finding Simple - Seat Map Design for Everyone  UX Australia 2014
Finding Simple - Seat Map Design for Everyone UX Australia 2014Jason Bayly
 
Mexico City - Cuidad de Mexico
Mexico City - Cuidad de MexicoMexico City - Cuidad de Mexico
Mexico City - Cuidad de MexicoAlan Doherty
 
Het voordeel van de twijfel
Het voordeel van de twijfelHet voordeel van de twijfel
Het voordeel van de twijfelJan Lelie
 
Carlo Prisco, Profili giuridici della corrispondenza elettronica
Carlo Prisco, Profili giuridici della corrispondenza elettronicaCarlo Prisco, Profili giuridici della corrispondenza elettronica
Carlo Prisco, Profili giuridici della corrispondenza elettronicaAndrea Rossetti
 
Marco Tullio Giordano, Digital Identity - part3
Marco Tullio Giordano, Digital Identity - part3Marco Tullio Giordano, Digital Identity - part3
Marco Tullio Giordano, Digital Identity - part3Andrea Rossetti
 
Fornitures de rellotge
Fornitures de rellotgeFornitures de rellotge
Fornitures de rellotgemarblocs
 
Loch Skene Glaciated Landscape
 Loch Skene Glaciated Landscape Loch Skene Glaciated Landscape
Loch Skene Glaciated LandscapeAlan Doherty
 

Destacado (20)

07 ZamyšLení ČTyřI SvíčKy
07  ZamyšLení ČTyřI SvíčKy07  ZamyšLení ČTyřI SvíčKy
07 ZamyšLení ČTyřI SvíčKy
 
Silverlight Ux Talk External
Silverlight Ux Talk ExternalSilverlight Ux Talk External
Silverlight Ux Talk External
 
CBS Outdoor 4 of 5
CBS Outdoor 4 of 5CBS Outdoor 4 of 5
CBS Outdoor 4 of 5
 
New Media Addicts Anonymous
New Media Addicts AnonymousNew Media Addicts Anonymous
New Media Addicts Anonymous
 
Knooppuntcafé Roparun Team 296 Beeld en Geluid
Knooppuntcafé Roparun Team 296 Beeld en GeluidKnooppuntcafé Roparun Team 296 Beeld en Geluid
Knooppuntcafé Roparun Team 296 Beeld en Geluid
 
Multiplatform & Multiscreen Ecosystem
Multiplatform & Multiscreen EcosystemMultiplatform & Multiscreen Ecosystem
Multiplatform & Multiscreen Ecosystem
 
10 stories
10 stories10 stories
10 stories
 
Finding Simple - Seat Map Design for Everyone UX Australia 2014
Finding Simple - Seat Map Design for Everyone  UX Australia 2014Finding Simple - Seat Map Design for Everyone  UX Australia 2014
Finding Simple - Seat Map Design for Everyone UX Australia 2014
 
clase ungs
clase ungsclase ungs
clase ungs
 
Mexico City - Cuidad de Mexico
Mexico City - Cuidad de MexicoMexico City - Cuidad de Mexico
Mexico City - Cuidad de Mexico
 
La nit
La nitLa nit
La nit
 
Do Not Complain
Do Not ComplainDo Not Complain
Do Not Complain
 
Solar Power
Solar PowerSolar Power
Solar Power
 
Map
MapMap
Map
 
Het voordeel van de twijfel
Het voordeel van de twijfelHet voordeel van de twijfel
Het voordeel van de twijfel
 
Carlo Prisco, Profili giuridici della corrispondenza elettronica
Carlo Prisco, Profili giuridici della corrispondenza elettronicaCarlo Prisco, Profili giuridici della corrispondenza elettronica
Carlo Prisco, Profili giuridici della corrispondenza elettronica
 
Marco Tullio Giordano, Digital Identity - part3
Marco Tullio Giordano, Digital Identity - part3Marco Tullio Giordano, Digital Identity - part3
Marco Tullio Giordano, Digital Identity - part3
 
Fornitures de rellotge
Fornitures de rellotgeFornitures de rellotge
Fornitures de rellotge
 
Loch Skene Glaciated Landscape
 Loch Skene Glaciated Landscape Loch Skene Glaciated Landscape
Loch Skene Glaciated Landscape
 
Dining With Cannibals
Dining With CannibalsDining With Cannibals
Dining With Cannibals
 

Similar a Comet from JavaOne 2008

Joe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand DwrJoe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand Dwrdeimos
 
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...Sencha
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NETAlessandro Giorgetti
 
Game server development in node.js in jsconf eu
Game server development in node.js in jsconf euGame server development in node.js in jsconf eu
Game server development in node.js in jsconf euXie ChengChao
 
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)Carles Farré
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applicationsdominion
 
Comet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumComet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumJoe Walker
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologiesgeorge.james
 
Flux: A Language for Programming High-Performance Servers
Flux: A Language for Programming High-Performance ServersFlux: A Language for Programming High-Performance Servers
Flux: A Language for Programming High-Performance ServersEmery Berger
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008Association Paris-Web
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Architecting &Building Scalable Secure Web API
Architecting &Building Scalable Secure Web APIArchitecting &Building Scalable Secure Web API
Architecting &Building Scalable Secure Web APISHAKIL AKHTAR
 
Developing Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDeveloping Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDoris Chen
 

Similar a Comet from JavaOne 2008 (20)

Joe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand DwrJoe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand Dwr
 
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
 
08 ajax
08 ajax08 ajax
08 ajax
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
Signal R 2015
Signal R 2015Signal R 2015
Signal R 2015
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET
 
Game server development in node.js in jsconf eu
Game server development in node.js in jsconf euGame server development in node.js in jsconf eu
Game server development in node.js in jsconf eu
 
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Unit 02: Web Technologies (2/2)
Unit 02: Web Technologies (2/2)Unit 02: Web Technologies (2/2)
Unit 02: Web Technologies (2/2)
 
Comet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumComet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way Medium
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
 
Flux: A Language for Programming High-Performance Servers
Flux: A Language for Programming High-Performance ServersFlux: A Language for Programming High-Performance Servers
Flux: A Language for Programming High-Performance Servers
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
Grails and Ajax
Grails and AjaxGrails and Ajax
Grails and Ajax
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Architecting &Building Scalable Secure Web API
Architecting &Building Scalable Secure Web APIArchitecting &Building Scalable Secure Web API
Architecting &Building Scalable Secure Web API
 
Developing Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDeveloping Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax Push
 

Último

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Último (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Comet from JavaOne 2008

  • 1. Comet ☄ The Rise of Highly Interactive Web Sites
  • 3. Long lived HTTP A pattern not a protocol Distinct from polling Reverse Ajax == Comet + Polling
  • 4. Pushing data to the browser without needing the browser to ask
  • 5.
  • 6.
  • 7. Why? Ajax made individual pages interactive places to explore More and more of the data on the web is social and therefore changing
  • 8. Why? Time people spend on a page Time before a page changes Evolution of the Web
  • 9. Time Server Ajax Interaction Time Server Comet Updates State
  • 11. Comet is for ... • keeping me up to date ... with ... • everyone else, and • everything else
  • 12. 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
  • 13. Everything else What is System X doing? • Data streaming • Async processing • Transaction fulfillment
  • 14. 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
  • 15. Before comet, services were one way. Now services can talk back
  • 16. Async made easy • fire and forget • growl/toast for the web
  • 17. Programming model changes: • Waiter vs. Buffet • The server is an event bus • State changes are events!
  • 18. Changing the user experience
  • 27. Inboard (e.g. DWR) • Simpler for new development • Harder scaling • Comet is just part of the infrastructure
  • 28. CometD App Server
  • 29. CometD App Server
  • 30. CometD App Server
  • 31. CometD App Server
  • 32. CometD App Server
  • 33. CometD App Server
  • 34. CometD App Server
  • 35. Outboard (e.g. Cometd): • Add-on that doesn’t affect the server • Easier to add to existing apps • Harder to get started
  • 36. Demo
  • 37. On the Client On the Server share.html <p>Share price: <span id='price'> </span> </p>
  • 38. On the Client On the Server share.html <p>Share price: import org.directwebremoting.ui.dwr.Util; <span id='price'> </span> Util.setValue(quot;pricequot;, 42); </p>
  • 39. On the Client On the Server share.html <p>Share price: import org....scriptaculous.Effect <span id='price'> </span> Effect.shake(quot;pricequot;); </p>
  • 40. On the Client On the Server share.html <p>Share price: import jsx3.gui.* <span id='price'> </span> Server s = GI.getServer(quot;appquot;); </p> Button b = s.getJSXById(quot;idquot;, Button.class); b.setEnabled(Form.STATEDISABLED, true);
  • 41. On the Client On the Server share.html <p>Share price: import org.dojotoolkit.dijit.Dijit; <span id='price'> import org.dojotoolkit.dijit.Editor; </span> </p> Editor e = Dijit.byId(quot;pricequot;, Editor.class); e.setValue(42);
  • 42. On the Client On the Server share.html ScriptSessionFilter f = ...; <p>Share price: Runnable r = new Runnable() { <span id='price'> public void run() { </span> ... </p> } }; Browser.withAllSessionsFiltered(f, r);
  • 43. On the Client On the Server share.html String s = quot;dwr.util.setValue('price', 42)quot;; <p>Share price: ScriptBuffer b = new ScriptBuffer(s); <span id='price'> </span> for (ScriptSession session : sessions) { </p> session.addScript(b); }
  • 44. On the Client On the Server share.html <p>Share price: <span id='price'> </span> </p>
  • 47. Client Server Client Server Client Server Time Time Time Polling Long Poll Forever Frame Load Profiles
  • 48.
  • 49. client one client one client two client two comet ajax ajax ajax request handler request handler app logic app logic database database server server Time Time
  • 50. But ... It’s a hack ... for now
  • 51. Client Issues Maximum of 2 connections per browser per host (IE7/6) • Coordination using window.name in the client • or cookies using a server • or use multi-home DNS HTTP streaming is download only (chunked mode) TCP connections are kept alive under HTTP 1.1 Server detection of failed connections
  • 52. Not A Hack Much Longer New browsers will make it better: • IE 8, FF3 raise number of connections • HTML 5 event sources • Opera already implements • HTML 5 DOM Storage provides way to synchronize across tabs and frames
  • 53. Client How-to: Forever Frame Client posts an iframe which doesn’t close quickly • Send text/plain and poll in browser (not IE) • Send text/plain with 4k whitespace to flush IE • Flush with a <script> tag for each data block The iframe will need killing and restarting to avoid memory leak But IE clicks when iframe starts
  • 54. Client How-to: Long Polling Client makes an XHR request which does not return immediately IE disallows reading XHR.responseText until connection is closed Although you can keep XHR frames open forever, generally you poll
  • 55. Client How-to: htmlfile ‘htmlfile’ is an ActiveX control like XHR: htmlfile = new ActiveXObject(quot;htmlfilequot;); htmlfile.open(); htmlfile.write(quot;<html><iframe src='javascript:void(0)' onload='cleanup();'></iframe></html>quot;); htmlfile.close(); htmlfile.parentWindow.dwr = dwr; Avoids ‘clicking’, but doesn’t work in IE/Server 2003 Not supported in Firefox, Safari, Opera, etc.
  • 56. Client How-to: Callback Polling Create <script> blocks pointing to any domain Create new script block when last completes
  • 57. Client How-to: Other Options Mime Messaging: • Uses Multipart Mime in HTML: x-multipart-replace • Not in IE • Excellent performance Server-Sent Events: WHATWG, but Opera only Flash: We probably have enough other options that we don’t need to get into plugins
  • 58. Server Tricks Watch out for stream-stoppers • Apache: mod_jk • Buggy network proxies • Various application firewalls Watch out for thread starvation
  • 59. Does that stop us? Ajax is also a hack, but that hasn’t stopped it And Comet does work
  • 60. Comet vs. Polling For Polling: • More efficient for very low latencies • Simpler to implement For Comet: • More efficient for all but very low latencies • More adaptable