Comet: an Overview and a New Solution Called Jabbify

3,232 views
3,111 views

Published on

Brian Moschel delivered this talk at the JS.Chi() April 2009 meetup. This talk provides an overview of Comet, also known as HTTP Push, covering how it works on the server and client, several implementation options, and using a new Comet API called Jabbify in an interactive demo.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,232
On SlideShare
0
From Embeds
0
Number of Embeds
93
Actions
Shares
0
Downloads
18
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Comet: an Overview and a New Solution Called Jabbify

  1. 1. Comet Overview Brian Moschel Jupiter IT
  2. 2. Overview Why Comet How It Showcase Jabbify Demo Comet? Overview Works
  3. 3. Why Comet? • Web 2.0 Trends 1. Time Spent on a Page
  4. 4. Why Comet? • Web 2.0 Trends 2. Half life of a Page’s Content
  5. 5. Why Comet? • Demand for Comet is growing • Desktop apps moving to the web • Chat • Real time updates • Don’t like to reload • Ajax:2003::Comet:2009
  6. 6. Uses • Multi user collaboration apps – Wiki – Presentation • Communication – Chat • Preventing stale data – Stock ticker – Social web updates • Others?
  7. 7. Polling vs. Comet Polling Server Are we Are we Are we No No No There yet? There yet? There yet? Client Comet Long Polling Server Wait for data Wait for data Client
  8. 8. How Comet Works: Client Side • Long Poll – How? • XHR, JSONP, or any transport, with connection held open – Pro • It works cross browser – Con • More overhead • Forever Frame – How? • Iframe • Multipart XHR – Pro • Less overhead, quicker responses – Con • Lack of error handling, not cross browser
  9. 9. Client Side Issues • Cross Browser – Duh • 2 Connection Limit – Use wildcard DNS – Xxx.mywebsite.com -> mywebsite.com • Synchronous request s (for JSONP) – Long poll has to close to allow other requests to process
  10. 10. How Comet Works: Server Side • Simultaneous connections – Traditional servers can’t scale – A thread shared multiple connections • Wake up when you’re ready to send data
  11. 11. How Comet Works: Server Side • Python – Orbited – Cometd • Java – Jetty • Erlang – ErlyComet • .NET – Lightstreamer • Service – Jabbify
  12. 12. Server Side Issues • Scaling – Every user = 1 connection • Complexity – Threading – Learning Curve
  13. 13. What is Jabbify? • Comet, simplified • No server • No setup • JavaScript API and GET requests
  14. 14. Why Jabbify? Simple to use Scale easily Rapid setup
  15. 15. Simple to use synchronized (_continuations) { for(Iterator<Map.Entry <String, ArrayList<Continuation>>> iter = _continuations.entrySet().iterator(); iter.hasNext();){ Map.Entry<String, ArrayList<Continuation>> entry = iter.next(); ArrayList<Continuation> continuations = entry.getValue(); for(Continuation c : continuations){ c.resume(); } } _continuations.clear(); } vs Jabbify.connect({name: this.username}, this.continue_to('after_connect')) after_connect: function(){ Jabbify.send('vote','submit', {result: this.result}) }
  16. 16. Scale easily • Scaling comet >> Scaling traditional web applications • Resource intensive • Jabbify is built to scale as usage grows
  17. 17. Rapid Setup <New id=quot;cfquot; class=quot;org.mortbay.jetty.plus.naming.Resourcequot;> <Arg>jms/connectionFactory</Arg> <Arg> <New class=quot;org.apache.activemq.ActiveMQConnectionFactoryquot;> <Arg>failover:(tcp://localhost:61616)?initialReconnectDelay=20&amp;maxReconnectDe lay=900</Arg> </New> </Arg> </New> vs <script language=quot;javascriptquot; type=quot;text/javascriptquot; src=quot;jabbify.jsquot;></script>
  18. 18. Comet is complex • Client – Transports (JSONP, Window.name, Flash, XHR, iframe) • Server – Special server – Setup time – Learning curve • Scaling – Resource consumption – Threading issues
  19. 19. Jabbify is simple • Client to Client Comet – JavaScript API • Jabbify.send(“message”,”create”,{message: “hi there”}); • Server to Client Comet – GET requests • https://jabbify.com/message_push?key=123&type=message...
  20. 20. How It Works
  21. 21. Demo
  22. 22. Take Home Points Comet is coming Jabbify = easy Comet
  23. 23. Showcase • Jabbify Simple Chat Client • Keyboard Demo • Chat.unwrongest.com

×