SlideShare a Scribd company logo
1 of 31
Download to read offline
Comet: Making The Web a 2-Way Medium
            Joe Walker, DWR Lead Developer
What is Comet?




Long lived HTTP connections
 •Low latency data
 •For events outside the browser
Agenda:



Use Cases

Techniques

Technologies

Demos
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
Why?




Simply keeping a page up to date is easy: poll

But polling kills servers

Comet keeps pages up to date *efficiently*
But ...




It’s a hack - the web is biased against it
Does that stop us?




Ajax is also a hack, but that hasn’t stopped it

And Comet does work
Examples of Comet

Chat is everywhere: GMail, Meebo, Yahoo Mail, etc.
GMail uses it to update email conversations
Google Docs uses it to show you other collaborators actions
yes.com uses it to track radio station playlists
Polar Rose are using it for delayed photo recognition
GPokr is using it for online gaming
etc...
Agenda:



Use Cases

Techniques

Technologies

Demos
Client Tricks

Maximum of 2 connections per browser per host
 •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

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
Agenda:



Use Cases

Techniques

Technologies

Demos
Saving you the Pain

On the Server:
 •Jetty, Twisted Python, Grizzly, Lighttpd, Perbal

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);

    ...
}
DWR




      Reverse Ajax == Comet + Polling + Piggyback
             (It’s just a configuration option)

 Allowing the server to easily manage groups of users
DWR, Reverse Ajax




DWR calling remote Javascript
Collection sessions = context.getScriptSessionsByPage(url);

ScriptProxy proxy = new ScriptProxy(sessions);
proxy.addFunctionCall(quot;updateCallersquot;, calls);
DWR, Reverse Ajax




DWR calling remote Script.aculo.us
Collection sessions = context.getScriptSessionsByPage(url);

Effect e = new Effect(sessions);
e.fade(quot;client-idquot;);
DWR, Reverse Ajax



DWR calling remote TIBCO GI
Collection sessions = context.getScriptSessionsByPage(url);

Server server = GI.getServer(sessions, quot;appnamequot;);
Button button = server.getJSXById(quot;buttonquot;, Button.class);
button.setEnabled(Form.STATEDISABLED, true);
Bayeux Performance
Agenda:



Use Cases

Techniques

Technologies

Demos
Demo


       http://www.webtide.com/sessionRater/
Demo
Questions?
http://cometdaily.com/   http://getahead.org/blog/joe/
http://cometd.com/       http://directwebremoting.org/

More Related Content

What's hot

Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On FireJef Claes
 
vlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets Presentationvlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets PresentationVolodymyr Lavrynovych
 
Altitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeAltitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeFastly
 
Altitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly WorkshopAltitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly WorkshopFastly
 
wa-cometjava-pdf
wa-cometjava-pdfwa-cometjava-pdf
wa-cometjava-pdfHiroshi Ono
 
HTML5 WebSocket Introduction
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket IntroductionMarcelo Jabali
 
Avatar Maven
Avatar MavenAvatar Maven
Avatar Mavenjlorenzen
 
Systems Introspection
Systems IntrospectionSystems Introspection
Systems IntrospectionAndrew Howden
 
TLS - 2016 Velocity Training
TLS - 2016 Velocity TrainingTLS - 2016 Velocity Training
TLS - 2016 Velocity TrainingPatrick Meenan
 
Building a scalable online backup system in python
Building a scalable online backup system in pythonBuilding a scalable online backup system in python
Building a scalable online backup system in pythonJoe Drumgoole
 
Tricks and Tips With NIO Using the Grizzly Framework
Tricks and Tips With NIO Using the Grizzly FrameworkTricks and Tips With NIO Using the Grizzly Framework
Tricks and Tips With NIO Using the Grizzly Frameworkelliando dias
 
What every Java developer should know about network?
What every Java developer should know about network?What every Java developer should know about network?
What every Java developer should know about network?aragozin
 

What's hot (20)

Web sockets in Java
Web sockets in JavaWeb sockets in Java
Web sockets in Java
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On Fire
 
Time for Comet?
Time for Comet?Time for Comet?
Time for Comet?
 
vlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets Presentationvlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets Presentation
 
DDoS: practical survival
DDoS: practical survivalDDoS: practical survival
DDoS: practical survival
 
jWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerry
jWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerryjWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerry
jWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerry
 
Altitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeAltitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the Edge
 
Altitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly WorkshopAltitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly Workshop
 
ZN27112015
ZN27112015ZN27112015
ZN27112015
 
wa-cometjava-pdf
wa-cometjava-pdfwa-cometjava-pdf
wa-cometjava-pdf
 
HTML5 WebSocket Introduction
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket Introduction
 
Avatar Maven
Avatar MavenAvatar Maven
Avatar Maven
 
WebSockets with Spring 4
WebSockets with Spring 4WebSockets with Spring 4
WebSockets with Spring 4
 
Systems Introspection
Systems IntrospectionSystems Introspection
Systems Introspection
 
TLS - 2016 Velocity Training
TLS - 2016 Velocity TrainingTLS - 2016 Velocity Training
TLS - 2016 Velocity Training
 
Building a scalable online backup system in python
Building a scalable online backup system in pythonBuilding a scalable online backup system in python
Building a scalable online backup system in python
 
Tricks and Tips With NIO Using the Grizzly Framework
Tricks and Tips With NIO Using the Grizzly FrameworkTricks and Tips With NIO Using the Grizzly Framework
Tricks and Tips With NIO Using the Grizzly Framework
 
Intro to WebSockets
Intro to WebSocketsIntro to WebSockets
Intro to WebSockets
 
What every Java developer should know about network?
What every Java developer should know about network?What every Java developer should know about network?
What every Java developer should know about network?
 

Viewers also liked

The Yemen-Arabia Felix
 The Yemen-Arabia Felix The Yemen-Arabia Felix
The Yemen-Arabia FelixAlan Doherty
 
Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...
Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...
Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...Geert Wissink
 
Integer Review!
Integer Review!Integer Review!
Integer Review!ejboggs
 
Sales Training ROI: An Oxymoron No More
Sales Training ROI: An Oxymoron No MoreSales Training ROI: An Oxymoron No More
Sales Training ROI: An Oxymoron No MoreCallidus Software
 
ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~
ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~
ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~Hikaru GOTO
 
Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...
Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...
Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...Amazon Web Services
 
Marco Vergani, E-commerce
Marco Vergani, E-commerceMarco Vergani, E-commerce
Marco Vergani, E-commerceAndrea Rossetti
 
Alessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet GovernanceAlessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet GovernanceAndrea Rossetti
 
getting started with amazon aurora
getting started with amazon auroragetting started with amazon aurora
getting started with amazon auroraAmazon Web Services
 
Putting GRAPHics into geoGRAPHy presentations
Putting GRAPHics into geoGRAPHy presentationsPutting GRAPHics into geoGRAPHy presentations
Putting GRAPHics into geoGRAPHy presentationsAlan Doherty
 
The Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested LandscapeThe Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested LandscapeAlan Doherty
 
Blue Raster Presentation for Earth Observation in the Cloud Demo Day
Blue Raster Presentation for Earth Observation in the Cloud Demo DayBlue Raster Presentation for Earth Observation in the Cloud Demo Day
Blue Raster Presentation for Earth Observation in the Cloud Demo DayAmazon Web Services
 
Luigi vannutelli, La dinamica dei Contratti ICT in Azienda
Luigi vannutelli, La dinamica dei Contratti ICT in AziendaLuigi vannutelli, La dinamica dei Contratti ICT in Azienda
Luigi vannutelli, La dinamica dei Contratti ICT in AziendaAndrea Rossetti
 
Dizzying Decimals
Dizzying DecimalsDizzying Decimals
Dizzying Decimalsejboggs
 

Viewers also liked (20)

The Yemen-Arabia Felix
 The Yemen-Arabia Felix The Yemen-Arabia Felix
The Yemen-Arabia Felix
 
Cff Pr
Cff PrCff Pr
Cff Pr
 
riee
rieeriee
riee
 
Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...
Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...
Budgeting and Funding - Lecture for Preservation & Presentation of the Moving...
 
Integer Review!
Integer Review!Integer Review!
Integer Review!
 
Sales Training ROI: An Oxymoron No More
Sales Training ROI: An Oxymoron No MoreSales Training ROI: An Oxymoron No More
Sales Training ROI: An Oxymoron No More
 
ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~
ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~
ケーズデンキの企業行動とパフォーマンス ~サービス差別化戦略の成功~
 
Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...
Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...
Keep Cloud Transformation on Track: Nine Best Practices to Avoid or Break Thr...
 
she
sheshe
she
 
教案與教材設計
教案與教材設計教案與教材設計
教案與教材設計
 
Marco Vergani, E-commerce
Marco Vergani, E-commerceMarco Vergani, E-commerce
Marco Vergani, E-commerce
 
Social Media Strategy
Social Media StrategySocial Media Strategy
Social Media Strategy
 
Alessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet GovernanceAlessandro Nicotra, Seminario Internet Governance
Alessandro Nicotra, Seminario Internet Governance
 
getting started with amazon aurora
getting started with amazon auroragetting started with amazon aurora
getting started with amazon aurora
 
sheNati
sheNatisheNati
sheNati
 
Putting GRAPHics into geoGRAPHy presentations
Putting GRAPHics into geoGRAPHy presentationsPutting GRAPHics into geoGRAPHy presentations
Putting GRAPHics into geoGRAPHy presentations
 
The Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested LandscapeThe Amazon Basin - a Contested Landscape
The Amazon Basin - a Contested Landscape
 
Blue Raster Presentation for Earth Observation in the Cloud Demo Day
Blue Raster Presentation for Earth Observation in the Cloud Demo DayBlue Raster Presentation for Earth Observation in the Cloud Demo Day
Blue Raster Presentation for Earth Observation in the Cloud Demo Day
 
Luigi vannutelli, La dinamica dei Contratti ICT in Azienda
Luigi vannutelli, La dinamica dei Contratti ICT in AziendaLuigi vannutelli, La dinamica dei Contratti ICT in Azienda
Luigi vannutelli, La dinamica dei Contratti ICT in Azienda
 
Dizzying Decimals
Dizzying DecimalsDizzying Decimals
Dizzying Decimals
 

Similar to Comet: Making The Web a 2-Way Medium

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
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008Joe Walker
 
Comet / WebSocket Web Applications
Comet / WebSocket Web ApplicationsComet / WebSocket Web Applications
Comet / WebSocket Web ApplicationsCodemotion
 
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoTWebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoTFrank Greco
 
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)Carles Farré
 
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
 
Node Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesNode Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesMakoto Inoue
 
«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
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawnozten
 

Similar to Comet: Making The Web a 2-Way Medium (20)

Grizzly Comet Aquarium Paris
Grizzly Comet Aquarium ParisGrizzly Comet Aquarium Paris
Grizzly Comet Aquarium Paris
 
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
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008
 
Comet / WebSocket Web Applications
Comet / WebSocket Web ApplicationsComet / WebSocket Web Applications
Comet / WebSocket Web Applications
 
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoTWebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
ServerSentEventsV2.pdf
ServerSentEventsV2.pdfServerSentEventsV2.pdf
ServerSentEventsV2.pdf
 
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
 
Meteor ddp
Meteor ddpMeteor ddp
Meteor ddp
 
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
 
Node js
Node jsNode js
Node js
 
Node Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesNode Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup Slides
 
gofortution
gofortutiongofortution
gofortution
 
«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
 
02 intro
02   intro02   intro
02 intro
 
Web Leaps Forward
Web Leaps ForwardWeb Leaps Forward
Web Leaps Forward
 
WebRTC Seminar Report
WebRTC  Seminar ReportWebRTC  Seminar Report
WebRTC Seminar Report
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
introduction to web application development
introduction to web application developmentintroduction to web application development
introduction to web application development
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
 

Recently uploaded

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
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
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
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
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 

Recently uploaded (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
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
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
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
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
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
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 

Comet: Making The Web a 2-Way Medium

  • 1. Comet: Making The Web a 2-Way Medium Joe Walker, DWR Lead Developer
  • 2. What is Comet? Long lived HTTP connections •Low latency data •For events outside the browser
  • 4. Why? Ajax made individual pages interactive places to explore More and more of the data on the web is social and therefore changing
  • 5. Why? Time people spend on a page Time before a page changes Evolution of the Web
  • 6. Why? Simply keeping a page up to date is easy: poll But polling kills servers Comet keeps pages up to date *efficiently*
  • 7. But ... It’s a hack - the web is biased against it
  • 8. Does that stop us? Ajax is also a hack, but that hasn’t stopped it And Comet does work
  • 9. Examples of Comet Chat is everywhere: GMail, Meebo, Yahoo Mail, etc. GMail uses it to update email conversations Google Docs uses it to show you other collaborators actions yes.com uses it to track radio station playlists Polar Rose are using it for delayed photo recognition GPokr is using it for online gaming etc...
  • 11. Client Tricks Maximum of 2 connections per browser per host •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
  • 12. 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
  • 13. 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
  • 14. 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.
  • 15. Client How-to: Callback Polling Create <script> blocks pointing to any domain Create new script block when last completes
  • 16. Client How-to: Other Options Mime Messaging: •Uses Multipart Mime in HTML: x-multipart-replace •Not in IE •Excellent performance Flash •We probably have enough other options that we don’t need to get into plugins
  • 17. Server Tricks Watch out for stream-stoppers •Apache: mod_jk •Buggy network proxies •Various application firewalls Watch out for thread starvation
  • 19. Saving you the Pain On the Server: •Jetty, Twisted Python, Grizzly, Lighttpd, Perbal Event Buses •Cometd, mod_pubsub, mod_repubsub, Lightstreamer, KnowHow, HAppS Frameworks •DWR, Juggernaut, Nevow
  • 20. Bayeux Standard Protocol for Interoperable Comet Supported by: •Cometd, Jetty, Dojo, DWR and servers in development from BEA, IBM and Sun
  • 21. 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(){/* ... */ });
  • 22. 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); ... }
  • 23. DWR Reverse Ajax == Comet + Polling + Piggyback (It’s just a configuration option) Allowing the server to easily manage groups of users
  • 24. DWR, Reverse Ajax DWR calling remote Javascript Collection sessions = context.getScriptSessionsByPage(url); ScriptProxy proxy = new ScriptProxy(sessions); proxy.addFunctionCall(quot;updateCallersquot;, calls);
  • 25. DWR, Reverse Ajax DWR calling remote Script.aculo.us Collection sessions = context.getScriptSessionsByPage(url); Effect e = new Effect(sessions); e.fade(quot;client-idquot;);
  • 26. DWR, Reverse Ajax DWR calling remote TIBCO GI Collection sessions = context.getScriptSessionsByPage(url); Server server = GI.getServer(sessions, quot;appnamequot;); Button button = server.getJSXById(quot;buttonquot;, Button.class); button.setEnabled(Form.STATEDISABLED, true);
  • 29. Demo http://www.webtide.com/sessionRater/
  • 30. Demo
  • 31. Questions? http://cometdaily.com/ http://getahead.org/blog/joe/ http://cometd.com/ http://directwebremoting.org/