Comet: Making The Web a 2-Way Medium

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    9 Favorites & 1 Group

    Comet: Making The Web a 2-Way Medium - Presentation Transcript

    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
    3. Agenda: Use Cases Techniques Technologies Demos
    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...
    10. Agenda: Use Cases Techniques Technologies Demos
    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(\"htmlfile\"); htmlfile.open(); htmlfile.write(\"<html><iframe src='javascript:void(0)' onload='cleanup();'></iframe></html>\"); 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
    18. Agenda: Use Cases Techniques Technologies Demos
    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(\"/topic\", {/* payload */}); dojox.cometd.subscribe(\"/topic\", 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(\"updateCallers\", calls);
    25. DWR, Reverse Ajax DWR calling remote Script.aculo.us Collection sessions = context.getScriptSessionsByPage(url); Effect e = new Effect(sessions); e.fade(\"client-id\");
    26. DWR, Reverse Ajax DWR calling remote TIBCO GI Collection sessions = context.getScriptSessionsByPage(url); Server server = GI.getServer(sessions, \"appname\"); Button button = server.getJSXById(\"button\", Button.class); button.setEnabled(Form.STATEDISABLED, true);
    27. Bayeux Performance
    28. Agenda: Use Cases Techniques Technologies Demos
    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/

    + Joe WalkerJoe Walker, 3 years ago

    custom

    7688 views, 9 favs, 9 embeds more stats

    A talk I did at FoWA

    More info about this presentation

    © All Rights Reserved

    • Total Views 7688
      • 7187 on SlideShare
      • 501 from embeds
    • Comments 0
    • Favorites 9
    • Downloads 316
    Most viewed embeds
    • 384 views on http://getahead.org
    • 73 views on http://dev.comlounge.net
    • 26 views on http://mrtopf.de
    • 12 views on http://www.nofluffjuststuff.com
    • 2 views on http://www.therichwebexperience.com

    more

    All embeds
    • 384 views on http://getahead.org
    • 73 views on http://dev.comlounge.net
    • 26 views on http://mrtopf.de
    • 12 views on http://www.nofluffjuststuff.com
    • 2 views on http://www.therichwebexperience.com
    • 1 views on http://www.hanrss.com
    • 1 views on http://getahead.ltd.uk
    • 1 views on http://directwebremoting.org
    • 1 views on http://translate.googleusercontent.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events