SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
Interactive Websites: Comet and DWR
                     Joe Walker, SitePen
Agenda:

Comet 101

The Ultimate Hack

Passing the Pain

DWR 101

Demos
What is Comet?
What is Comet?




Long lived HTTP connections
 •Low latency data
 •For events outside the browser
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
Comet turns the web into a network of people
 who interact more naturally than they could
     behind a request/response barrier.
Examples of Comet


Chat is everywhere: GMail, Meebo, Yahoo Mail ...
Collaborative Editing: GDocs, Thinkature, Jot
Streaming Financial Data: Lightstreamer, Caplin
Asynch Updates: GMail, Yes.com
Online Gaming: GPokr
Async Server Processing: Polar Rose
Agenda:

Comet 101

The Ultimate Hack

Passing the Pain

DWR 101

Demos
But ...




It’s a hack - the web is biased against it
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
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 currently 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
Agenda:

Comet 101

The Ultimate Hack

Passing the Pain

DWR 101

Demos
Saving you the Pain

On the Server:
 •Jetty, Twisted Python, Grizzly, Lighttpd, Perbal, Juggernaut
 •Everyone except Apache

Event Buses
  •Cometd, mod_pubsub, mod_repubsub, Lightstreamer,
   KnowHow, HAppS

Frameworks
  •DWR, Juggernaut, Nevow
Bayeux




Standard Protocol for Interoperable Comet

Supported by:
 •Cometd, Jetty, Dojo, DWR and servers in development
   from BEA, IBM and Sun
Bayeux on the Client via Cometd




Dojo client implementation:
dojox.cometd.init(serverUrl);
dojox.cometd.publish(quot;/topicquot;, {/* payload */});
dojox.cometd.subscribe(quot;/topicquot;, function(){/* ... */ });
Bayeux on the Server


package dojox.cometd;

public interface Bayeux
{
  Client newClient(String idprefix, Listener listener);

    void publish(Client fromClient, String toChannel,
                 Object data, String msgId);

    void subscribe(String toChannel, Client subscriber);

    ...
}
Bayeux Performance
Agenda:

Comet 101

The Ultimate Hack

Passing the Pain

DWR 101

Demos
On the Server

public class SomeObject {

    public String sayHello(String n) {
      return quot;Hello, quot; + n;
    }

    public Set<Car> find(long reg) {
      // ...
      return cars;
    }
}
On the Server
@RemoteProxy
public class SomeObject {
  @RemoteMethod
  public String sayHello(String n) {
    return quot;Hello, quot; + n;
  }
  @RemoteMethod
  public Set<Car> find(long reg) {
    // ...
    return cars;
  }
}
On the Server                            On the Client

public class SomeObject {                <script
                                          src='dwr/interface/SomeObject.js'>
    public String sayHello(String n) {
      return quot;Hello, quot; + n;
    }

    public Set<Car> find(long reg) {
      // ...
      return cars;
    }
}
On the Server                            On the Client

public class SomeObject {                <script
                                          src='dwr/interface/SomeObject.js'>
    public String sayHello(String n) {
      return quot;Hello, quot; + n;              <script>
    }                                    SomeObject.sayHello('Joe', update);

    public Set<Car> find(long reg) {      function update(data) {
      // ...                               $('field').innerHtml = data;
      return cars;                       }
    }                                    </script>
}
On the Server                            On the Client

public class SomeObject {                <script
                                          src='dwr/interface/SomeObject.js'>
    public String sayHello(String n) {
      return quot;Hello, quot; + n;              <script>
    }                                    SomeObject.find('a1', function(cars) {
                                           dwr.util.addRows(‘table’, cars, ...);
    public Set<Car> find(long reg) {      });
      // ...
      return cars;
    }                                    </script>
}
DWR can marshall:


  Primitive types, and their Object counterparts
     int, boolean, long, float, double, etc
  Obvious classes
     (String, Date, BigDecimal, BigInteger, Enum, etc)
  Arrays and Collections (Map, List, Set, Iterator, ...)
  JavaBeans and Objects
  XML objects (DOM, XOM, JDom, Dom4J)
  Images and Binary Files in version 3.0
                            (in short, basically anything ...)
Terms



         Comet = long lived HTTP connections

        Polling = regular short HTTP connections

    Piggyback = data smuggled on other connections

            Reverse Ajax = any of the above
On the Client

share.html

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

share.html           ServerContext ctx = ServerContextFactory.get();
                     Collection sessions =
<p>Share price:       ctx.getScriptSessionsByPage(quot;share.htmlquot;);
 <span id='price'>
 </span>
</p>
On the Client        On the Server

share.html           ServerContext ctx = ServerContextFactory.get();
                     Collection sessions =
<p>Share price:       ctx.getScriptSessionsByPage(quot;share.htmlquot;);
 <span id='price'>
 </span>             String s = quot;dwr.util.setValue('price', 42)quot;;
</p>                 ScriptBuffer b = new ScriptBuffer(s);

                     for (ScriptSession session : sessions) {
                       session.addScript(b);
                     }
On the Client        On the Server

share.html           ServerContext ctx = ServerContextFactory.get();
                     Collection sessions =
<p>Share price:       ctx.getScriptSessionsByPage(quot;share.htmlquot;);
 <span id='price'>
 </span>             Util pages = new Util(sessions);
</p>                 pages.setValue(quot;pricequot;, 42);
On the Client        On the Server

share.html           ServerContext ctx = ServerContextFactory.get();
                     Collection sessions =
<p>Share price:       ctx.getScriptSessionsByPage(quot;share.htmlquot;);
 <span id='price'>
 </span>             import org....scriptaculous.Effect
</p>
                     Effect e = new Effect(sessions);
                     e.shake(quot;pricequot;);
On the Client        On the Server

share.html           ServerContext ctx = ServerContextFactory.get();
                     Collection sessions =
<p>Share price:       ctx.getScriptSessionsByPage(quot;share.htmlquot;);
 <span id='price'>
 </span>             import jsx3.gui.*
</p>
                     Server s = GI.getServer(sessions, quot;appquot;);
                     Button b = s.getJSXById(quot;idquot;, Button.class);
                     b.setEnabled(Form.STATEDISABLED, true);
On the Client        On the Server

share.html           ServerContext ctx = ServerContextFactory.get();
                     Collection sessions =
<p>Share price:       ctx.getScriptSessionsByPage(quot;share.htmlquot;);
 <span id='price'>
 </span>             import org.dojotoolkit.dijit.Dijit;
</p>                 import org.dojotoolkit.dijit.Editor;

                     Dijit dijit = new Dijit(sessions);
                     Editor e = dijit.byId(quot;pricequot;, Editor.class);
                     e.setValue(42);
New in DWR 3.0


Converters: Image/Binary file upload/download

Busses: JMS, OpenAjax Hub

JSON / Bayeux support

Drapgen: GI and maybe Dojo in Java

Gears: Auto offline
Pub-Sub


Hub hub = HubFactory.get();

hub.publish(TOPIC_TEXT, info);

hub.subscribe(TOPIC_PEOPLE, new MessageListener() {
    public void onMessage(MessageEvent message) {
      Person p = message.getData(Person.class);
      // ...
    }
});
Gears

For a certain set of applications, offline comes free

Remote calls can be optional
 •‘Refresh’ is a common optional operation
 •‘Save’ is a common mandatory option


If offline, DWR will queue the mandatory ones for later, and
let you carry on without the optional ones.
Agenda:

Comet 101

The Ultimate Hack

Passing the Pain

DWR 101

Demos
Questions?
http://cometdaily.com/   http://getahead.org/blog/joe/
http://cometd.com/       http://directwebremoting.org/

Mais conteúdo relacionado

Mais procurados

JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)jeresig
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KThomas Fuchs
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 
Node.js in action
Node.js in actionNode.js in action
Node.js in actionSimon Su
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do MoreRemy Sharp
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJSSylvain Zimmer
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIsRemy Sharp
 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDAleix Vergés
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performanceYehuda Katz
 
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security PlayLove and Loss: A Symfony Security Play
Love and Loss: A Symfony Security PlayKris Wallsmith
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonKris Wallsmith
 
Guard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful SecurityGuard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful SecurityRyan Weaver
 
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Konstantin Kudryashov
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperJon Kruger
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-futureyiming he
 

Mais procurados (20)

JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Node.js in action
Node.js in actionNode.js in action
Node.js in action
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
Matters of State
Matters of StateMatters of State
Matters of State
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJS
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performance
 
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security PlayLove and Loss: A Symfony Security Play
Love and Loss: A Symfony Security Play
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
 
Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
 
Guard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful SecurityGuard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful Security
 
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-future
 

Destaque

Telling the Stories That Will Raise More Money
Telling the Stories That Will Raise More MoneyTelling the Stories That Will Raise More Money
Telling the Stories That Will Raise More MoneyKivi Leroux Miller
 
Day 2 2nd_weekcris
Day 2 2nd_weekcrisDay 2 2nd_weekcris
Day 2 2nd_weekcriscristiarnau
 
Social Media Marketing SIIA Presentation
Social Media Marketing SIIA PresentationSocial Media Marketing SIIA Presentation
Social Media Marketing SIIA Presentationmweisburgh
 
Opera mini use_and_user_behavior_white_paper
Opera mini use_and_user_behavior_white_paperOpera mini use_and_user_behavior_white_paper
Opera mini use_and_user_behavior_white_paperLiu Xing
 
Xxx a techos alrededor del mundo
Xxx a techos alrededor del mundoXxx a techos alrededor del mundo
Xxx a techos alrededor del mundoamfelisa
 
How metrics shape decisions f2psummit
How metrics shape decisions f2psummitHow metrics shape decisions f2psummit
How metrics shape decisions f2psummitPascal Zuta
 
Rasna Presentation Part II
Rasna Presentation Part IIRasna Presentation Part II
Rasna Presentation Part IImaverickrathore
 
Lectii Corporative
Lectii CorporativeLectii Corporative
Lectii CorporativeAlexandru S
 
Creating a Culture around Social Media
Creating a Culture around Social MediaCreating a Culture around Social Media
Creating a Culture around Social MediaSimon Young
 
PolyU BBA Management
PolyU BBA ManagementPolyU BBA Management
PolyU BBA Managementpolyduck
 
10 11 induction slides
10 11 induction slides10 11 induction slides
10 11 induction slidesBoyd Kassandra
 
Exercícios de Trigonometria Resolvidos
Exercícios de Trigonometria ResolvidosExercícios de Trigonometria Resolvidos
Exercícios de Trigonometria ResolvidosFlaber Bertochi
 
Day 3 2nd_weekcris
Day 3 2nd_weekcrisDay 3 2nd_weekcris
Day 3 2nd_weekcriscristiarnau
 
Granada 1878-g
Granada  1878-gGranada  1878-g
Granada 1878-gamfelisa
 
Flipflops
FlipflopsFlipflops
Flipflopsbecz_y
 
This Transliterate Life
This Transliterate LifeThis Transliterate Life
This Transliterate LifeBobbi Newman
 
Het Spel Van De Wereld
Het Spel Van De WereldHet Spel Van De Wereld
Het Spel Van De WereldyentelB
 
Connecting cape town v3.0.pptx
Connecting cape town v3.0.pptxConnecting cape town v3.0.pptx
Connecting cape town v3.0.pptxBrian Pinnock
 
Social Media In the Workplace
Social Media In the WorkplaceSocial Media In the Workplace
Social Media In the WorkplaceSimon Young
 

Destaque (20)

OCC Presentation
OCC PresentationOCC Presentation
OCC Presentation
 
Telling the Stories That Will Raise More Money
Telling the Stories That Will Raise More MoneyTelling the Stories That Will Raise More Money
Telling the Stories That Will Raise More Money
 
Day 2 2nd_weekcris
Day 2 2nd_weekcrisDay 2 2nd_weekcris
Day 2 2nd_weekcris
 
Social Media Marketing SIIA Presentation
Social Media Marketing SIIA PresentationSocial Media Marketing SIIA Presentation
Social Media Marketing SIIA Presentation
 
Opera mini use_and_user_behavior_white_paper
Opera mini use_and_user_behavior_white_paperOpera mini use_and_user_behavior_white_paper
Opera mini use_and_user_behavior_white_paper
 
Xxx a techos alrededor del mundo
Xxx a techos alrededor del mundoXxx a techos alrededor del mundo
Xxx a techos alrededor del mundo
 
How metrics shape decisions f2psummit
How metrics shape decisions f2psummitHow metrics shape decisions f2psummit
How metrics shape decisions f2psummit
 
Rasna Presentation Part II
Rasna Presentation Part IIRasna Presentation Part II
Rasna Presentation Part II
 
Lectii Corporative
Lectii CorporativeLectii Corporative
Lectii Corporative
 
Creating a Culture around Social Media
Creating a Culture around Social MediaCreating a Culture around Social Media
Creating a Culture around Social Media
 
PolyU BBA Management
PolyU BBA ManagementPolyU BBA Management
PolyU BBA Management
 
10 11 induction slides
10 11 induction slides10 11 induction slides
10 11 induction slides
 
Exercícios de Trigonometria Resolvidos
Exercícios de Trigonometria ResolvidosExercícios de Trigonometria Resolvidos
Exercícios de Trigonometria Resolvidos
 
Day 3 2nd_weekcris
Day 3 2nd_weekcrisDay 3 2nd_weekcris
Day 3 2nd_weekcris
 
Granada 1878-g
Granada  1878-gGranada  1878-g
Granada 1878-g
 
Flipflops
FlipflopsFlipflops
Flipflops
 
This Transliterate Life
This Transliterate LifeThis Transliterate Life
This Transliterate Life
 
Het Spel Van De Wereld
Het Spel Van De WereldHet Spel Van De Wereld
Het Spel Van De Wereld
 
Connecting cape town v3.0.pptx
Connecting cape town v3.0.pptxConnecting cape town v3.0.pptx
Connecting cape town v3.0.pptx
 
Social Media In the Workplace
Social Media In the WorkplaceSocial Media In the Workplace
Social Media In the Workplace
 

Semelhante a Joe Walker Interactivewebsites Cometand Dwr

Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008Joe Walker
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsYakov Fain
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web ToolkitsYiguang Hu
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJSWei Ru
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqelajobandesther
 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009Robbie Cheng
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...Tom Croucher
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...Tom Croucher
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication developmentGanesh Gembali
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScriptQiangning Hong
 
Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Alessandro Molina
 
Java web programming
Java web programmingJava web programming
Java web programmingChing Yi Chan
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSphilogb
 
JavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de DatosJavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de Datosphilogb
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comVan-Duyet Le
 

Semelhante a Joe Walker Interactivewebsites Cometand Dwr (20)

Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web Toolkits
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript
 
Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2
 
08 ajax
08 ajax08 ajax
08 ajax
 
Java web programming
Java web programmingJava web programming
Java web programming
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
 
JavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de DatosJavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de Datos
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.com
 

Mais de deimos

Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Rubydeimos
 
Randy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural PrinciplesRandy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural Principlesdeimos
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvmdeimos
 
Aslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec BddAslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec Bdddeimos
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovydeimos
 
Venkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic LanguagesVenkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic Languagesdeimos
 
Udi Dahan Intentions And Interfaces
Udi Dahan Intentions And InterfacesUdi Dahan Intentions And Interfaces
Udi Dahan Intentions And Interfacesdeimos
 
Tim Mackinnon Agile And Beyond
Tim Mackinnon Agile And BeyondTim Mackinnon Agile And Beyond
Tim Mackinnon Agile And Beyonddeimos
 
Steve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And SerendipitySteve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And Serendipitydeimos
 
Stefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The WebStefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The Webdeimos
 
Stefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To RestStefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To Restdeimos
 
Rod Johnson Cathedral
Rod Johnson CathedralRod Johnson Cathedral
Rod Johnson Cathedraldeimos
 
Mike Stolz Dramatic Scalability
Mike Stolz Dramatic ScalabilityMike Stolz Dramatic Scalability
Mike Stolz Dramatic Scalabilitydeimos
 
Matt Youill Betfair
Matt Youill BetfairMatt Youill Betfair
Matt Youill Betfairdeimos
 
Pete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two SystemsPete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two Systemsdeimos
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registrydeimos
 
Ola Bini Evolving The Java Platform
Ola Bini Evolving The Java PlatformOla Bini Evolving The Java Platform
Ola Bini Evolving The Java Platformdeimos
 
Neal Gafter Java Evolution
Neal Gafter Java EvolutionNeal Gafter Java Evolution
Neal Gafter Java Evolutiondeimos
 
Markus Voelter Textual DSLs
Markus Voelter Textual DSLsMarkus Voelter Textual DSLs
Markus Voelter Textual DSLsdeimos
 
Marc Evers People Vs Process Beyond Agile
Marc Evers People Vs Process Beyond AgileMarc Evers People Vs Process Beyond Agile
Marc Evers People Vs Process Beyond Agiledeimos
 

Mais de deimos (20)

Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Ruby
 
Randy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural PrinciplesRandy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural Principles
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvm
 
Aslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec BddAslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec Bdd
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovy
 
Venkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic LanguagesVenkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic Languages
 
Udi Dahan Intentions And Interfaces
Udi Dahan Intentions And InterfacesUdi Dahan Intentions And Interfaces
Udi Dahan Intentions And Interfaces
 
Tim Mackinnon Agile And Beyond
Tim Mackinnon Agile And BeyondTim Mackinnon Agile And Beyond
Tim Mackinnon Agile And Beyond
 
Steve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And SerendipitySteve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And Serendipity
 
Stefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The WebStefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The Web
 
Stefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To RestStefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To Rest
 
Rod Johnson Cathedral
Rod Johnson CathedralRod Johnson Cathedral
Rod Johnson Cathedral
 
Mike Stolz Dramatic Scalability
Mike Stolz Dramatic ScalabilityMike Stolz Dramatic Scalability
Mike Stolz Dramatic Scalability
 
Matt Youill Betfair
Matt Youill BetfairMatt Youill Betfair
Matt Youill Betfair
 
Pete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two SystemsPete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two Systems
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registry
 
Ola Bini Evolving The Java Platform
Ola Bini Evolving The Java PlatformOla Bini Evolving The Java Platform
Ola Bini Evolving The Java Platform
 
Neal Gafter Java Evolution
Neal Gafter Java EvolutionNeal Gafter Java Evolution
Neal Gafter Java Evolution
 
Markus Voelter Textual DSLs
Markus Voelter Textual DSLsMarkus Voelter Textual DSLs
Markus Voelter Textual DSLs
 
Marc Evers People Vs Process Beyond Agile
Marc Evers People Vs Process Beyond AgileMarc Evers People Vs Process Beyond Agile
Marc Evers People Vs Process Beyond Agile
 

Último

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Joe Walker Interactivewebsites Cometand Dwr

  • 1. Interactive Websites: Comet and DWR Joe Walker, SitePen
  • 2. Agenda: Comet 101 The Ultimate Hack Passing the Pain DWR 101 Demos
  • 4.
  • 5.
  • 6. What is Comet? Long lived HTTP connections •Low latency data •For events outside the browser
  • 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. Comet turns the web into a network of people who interact more naturally than they could behind a request/response barrier.
  • 10. Examples of Comet Chat is everywhere: GMail, Meebo, Yahoo Mail ... Collaborative Editing: GDocs, Thinkature, Jot Streaming Financial Data: Lightstreamer, Caplin Asynch Updates: GMail, Yes.com Online Gaming: GPokr Async Server Processing: Polar Rose
  • 11. Agenda: Comet 101 The Ultimate Hack Passing the Pain DWR 101 Demos
  • 12. But ... It’s a hack - the web is biased against it
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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.
  • 17. Client How-to: Callback Polling Create <script> blocks pointing to any domain Create new script block when last completes
  • 18. 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 currently Opera only Flash: We probably have enough other options that we don’t need to get into plugins
  • 19. Server Tricks Watch out for stream-stoppers •Apache: mod_jk •Buggy network proxies •Various application firewalls Watch out for thread starvation
  • 20. Does that stop us? Ajax is also a hack, but that hasn’t stopped it And Comet does work
  • 21. 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
  • 22. Agenda: Comet 101 The Ultimate Hack Passing the Pain DWR 101 Demos
  • 23. Saving you the Pain On the Server: •Jetty, Twisted Python, Grizzly, Lighttpd, Perbal, Juggernaut •Everyone except Apache Event Buses •Cometd, mod_pubsub, mod_repubsub, Lightstreamer, KnowHow, HAppS Frameworks •DWR, Juggernaut, Nevow
  • 24. Bayeux Standard Protocol for Interoperable Comet Supported by: •Cometd, Jetty, Dojo, DWR and servers in development from BEA, IBM and Sun
  • 25. Bayeux on the Client via Cometd Dojo client implementation: dojox.cometd.init(serverUrl); dojox.cometd.publish(quot;/topicquot;, {/* payload */}); dojox.cometd.subscribe(quot;/topicquot;, function(){/* ... */ });
  • 26. Bayeux on the Server package dojox.cometd; public interface Bayeux { Client newClient(String idprefix, Listener listener); void publish(Client fromClient, String toChannel, Object data, String msgId); void subscribe(String toChannel, Client subscriber); ... }
  • 28. Agenda: Comet 101 The Ultimate Hack Passing the Pain DWR 101 Demos
  • 29.
  • 30. On the Server public class SomeObject { public String sayHello(String n) { return quot;Hello, quot; + n; } public Set<Car> find(long reg) { // ... return cars; } }
  • 31. On the Server @RemoteProxy public class SomeObject { @RemoteMethod public String sayHello(String n) { return quot;Hello, quot; + n; } @RemoteMethod public Set<Car> find(long reg) { // ... return cars; } }
  • 32. On the Server On the Client public class SomeObject { <script src='dwr/interface/SomeObject.js'> public String sayHello(String n) { return quot;Hello, quot; + n; } public Set<Car> find(long reg) { // ... return cars; } }
  • 33. On the Server On the Client public class SomeObject { <script src='dwr/interface/SomeObject.js'> public String sayHello(String n) { return quot;Hello, quot; + n; <script> } SomeObject.sayHello('Joe', update); public Set<Car> find(long reg) { function update(data) { // ... $('field').innerHtml = data; return cars; } } </script> }
  • 34. On the Server On the Client public class SomeObject { <script src='dwr/interface/SomeObject.js'> public String sayHello(String n) { return quot;Hello, quot; + n; <script> } SomeObject.find('a1', function(cars) { dwr.util.addRows(‘table’, cars, ...); public Set<Car> find(long reg) { }); // ... return cars; } </script> }
  • 35. DWR can marshall: Primitive types, and their Object counterparts int, boolean, long, float, double, etc Obvious classes (String, Date, BigDecimal, BigInteger, Enum, etc) Arrays and Collections (Map, List, Set, Iterator, ...) JavaBeans and Objects XML objects (DOM, XOM, JDom, Dom4J) Images and Binary Files in version 3.0 (in short, basically anything ...)
  • 36.
  • 37. Terms Comet = long lived HTTP connections Polling = regular short HTTP connections Piggyback = data smuggled on other connections Reverse Ajax = any of the above
  • 38. On the Client share.html <p>Share price: <span id='price'> </span> </p>
  • 39. On the Client On the Server share.html ServerContext ctx = ServerContextFactory.get(); Collection sessions = <p>Share price: ctx.getScriptSessionsByPage(quot;share.htmlquot;); <span id='price'> </span> </p>
  • 40. On the Client On the Server share.html ServerContext ctx = ServerContextFactory.get(); Collection sessions = <p>Share price: ctx.getScriptSessionsByPage(quot;share.htmlquot;); <span id='price'> </span> String s = quot;dwr.util.setValue('price', 42)quot;; </p> ScriptBuffer b = new ScriptBuffer(s); for (ScriptSession session : sessions) { session.addScript(b); }
  • 41. On the Client On the Server share.html ServerContext ctx = ServerContextFactory.get(); Collection sessions = <p>Share price: ctx.getScriptSessionsByPage(quot;share.htmlquot;); <span id='price'> </span> Util pages = new Util(sessions); </p> pages.setValue(quot;pricequot;, 42);
  • 42. On the Client On the Server share.html ServerContext ctx = ServerContextFactory.get(); Collection sessions = <p>Share price: ctx.getScriptSessionsByPage(quot;share.htmlquot;); <span id='price'> </span> import org....scriptaculous.Effect </p> Effect e = new Effect(sessions); e.shake(quot;pricequot;);
  • 43. On the Client On the Server share.html ServerContext ctx = ServerContextFactory.get(); Collection sessions = <p>Share price: ctx.getScriptSessionsByPage(quot;share.htmlquot;); <span id='price'> </span> import jsx3.gui.* </p> Server s = GI.getServer(sessions, quot;appquot;); Button b = s.getJSXById(quot;idquot;, Button.class); b.setEnabled(Form.STATEDISABLED, true);
  • 44. On the Client On the Server share.html ServerContext ctx = ServerContextFactory.get(); Collection sessions = <p>Share price: ctx.getScriptSessionsByPage(quot;share.htmlquot;); <span id='price'> </span> import org.dojotoolkit.dijit.Dijit; </p> import org.dojotoolkit.dijit.Editor; Dijit dijit = new Dijit(sessions); Editor e = dijit.byId(quot;pricequot;, Editor.class); e.setValue(42);
  • 45. New in DWR 3.0 Converters: Image/Binary file upload/download Busses: JMS, OpenAjax Hub JSON / Bayeux support Drapgen: GI and maybe Dojo in Java Gears: Auto offline
  • 46. Pub-Sub Hub hub = HubFactory.get(); hub.publish(TOPIC_TEXT, info); hub.subscribe(TOPIC_PEOPLE, new MessageListener() { public void onMessage(MessageEvent message) { Person p = message.getData(Person.class); // ... } });
  • 47. Gears For a certain set of applications, offline comes free Remote calls can be optional •‘Refresh’ is a common optional operation •‘Save’ is a common mandatory option If offline, DWR will queue the mandatory ones for later, and let you carry on without the optional ones.
  • 48. Agenda: Comet 101 The Ultimate Hack Passing the Pain DWR 101 Demos
  • 49. Questions? http://cometdaily.com/ http://getahead.org/blog/joe/ http://cometd.com/ http://directwebremoting.org/