SlideShare a Scribd company logo
Comet web applications with Python, Django & Orbited @ PyCon Italia Qu4ttro http://www.pycon.it/ Massimo Scamarcia http://www.webright.it /
Comet web applications with Python, Django & Orbited ,[object Object]
Comet web applications with Python, Django & Orbited AJAX Polling ,[object Object]
Server: ,[object Object]
No data: sends empty response. ,[object Object]
Comet web applications with Python, Django & Orbited Latency, bandwidth, memory usage and scaling issues!
Comet web applications with Python, Django & Orbited ,[object Object]
Comet web applications with Python, Django & Orbited ,[object Object]
Long Polling, IFRAME stream, HTMLFile, XHR Streaming, HTML5 SSE
Comet web applications with Python, Django & Orbited ,[object Object]
Still waiting for an unanimous way to do it.
Comet web applications with Python, Django & Orbited Long Polling ,[object Object]
Server: holds the request. ,[object Object]
Timeout reached: empty response. ,[object Object]
Comet web applications with Python, Django & Orbited Http Push (HTTP Streaming*) ,[object Object]
Server: doesn't terminate the connection.
Server: sends data when available.
Connection closed:  ,[object Object]
Client reconnects. [*] http://ajaxpatterns.org/HTTP_Streaming
Comet web applications with Python, Django & Orbited ,[object Object]
Too many connections. ,[object Object],[object Object],[*] http://nichol.as/asynchronous-servers-in-python
Comet web applications with Python, Django & Orbited ,[object Object]
Comet web applications with Python, Django & Orbited He's here to solve problems!
Comet web applications with Python, Django & Orbited ,[object Object]

More Related Content

What's hot (10)

Servers with Event Machine - David Troy - RailsConf 2011
Servers with Event Machine - David Troy - RailsConf 2011Servers with Event Machine - David Troy - RailsConf 2011
Servers with Event Machine - David Troy - RailsConf 2011
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodb
 
Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009
 
Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010
 
Node.js: CAMTA Presentation
Node.js: CAMTA PresentationNode.js: CAMTA Presentation
Node.js: CAMTA Presentation
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8
 
Ruby HTTP clients
Ruby HTTP clientsRuby HTTP clients
Ruby HTTP clients
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 
WebSockets with PHP: Mission impossible
WebSockets with PHP: Mission impossibleWebSockets with PHP: Mission impossible
WebSockets with PHP: Mission impossible
 

Similar to Comet web applications with Python, Django & Orbited

Comet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedComet web applications with Python, Django & Orbited
Comet web applications with Python, Django & Orbited
PyCon Italia
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
marpierc
 
How OAuth and portable data can revolutionize your web app - Chris Messina
How OAuth and portable data can revolutionize your web app - Chris MessinaHow OAuth and portable data can revolutionize your web app - Chris Messina
How OAuth and portable data can revolutionize your web app - Chris Messina
Carsonified Team
 
Comet, Simplified, with Jabbify Comet Service
Comet, Simplified, with Jabbify Comet ServiceComet, Simplified, with Jabbify Comet Service
Comet, Simplified, with Jabbify Comet Service
Brian Moschel
 
Google G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebGoogle G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The Web
QConLondon2008
 
Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1
QConLondon2008
 

Similar to Comet web applications with Python, Django & Orbited (20)

Comet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedComet web applications with Python, Django & Orbited
Comet web applications with Python, Django & Orbited
 
Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
Real-time Ruby for the Real-time Web
Real-time Ruby for the Real-time WebReal-time Ruby for the Real-time Web
Real-time Ruby for the Real-time Web
 
Kurzeinführung: Atom Publishing Protocol
Kurzeinführung: Atom Publishing ProtocolKurzeinführung: Atom Publishing Protocol
Kurzeinführung: Atom Publishing Protocol
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
WebRTC: A front-end perspective
WebRTC: A front-end perspectiveWebRTC: A front-end perspective
WebRTC: A front-end perspective
 
Enterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersEnterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript Developers
 
How OAuth and portable data can revolutionize your web app - Chris Messina
How OAuth and portable data can revolutionize your web app - Chris MessinaHow OAuth and portable data can revolutionize your web app - Chris Messina
How OAuth and portable data can revolutionize your web app - Chris Messina
 
OAuth FTW
OAuth FTWOAuth FTW
OAuth FTW
 
Real-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsReal-Time Web applications with WebSockets
Real-Time Web applications with WebSockets
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
OGCE Project Overview
OGCE Project OverviewOGCE Project Overview
OGCE Project Overview
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Comet, Simplified, with Jabbify Comet Service
Comet, Simplified, with Jabbify Comet ServiceComet, Simplified, with Jabbify Comet Service
Comet, Simplified, with Jabbify Comet Service
 
Google G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebGoogle G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The Web
 
Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 

Comet web applications with Python, Django & Orbited

  • 1. Comet web applications with Python, Django & Orbited @ PyCon Italia Qu4ttro http://www.pycon.it/ Massimo Scamarcia http://www.webright.it /
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Comet web applications with Python, Django & Orbited Latency, bandwidth, memory usage and scaling issues!
  • 7.
  • 8.
  • 9. Long Polling, IFRAME stream, HTMLFile, XHR Streaming, HTML5 SSE
  • 10.
  • 11. Still waiting for an unanimous way to do it.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. Server: doesn't terminate the connection.
  • 17. Server: sends data when available.
  • 18.
  • 19. Client reconnects. [*] http://ajaxpatterns.org/HTTP_Streaming
  • 20.
  • 21.
  • 22.
  • 23. Comet web applications with Python, Django & Orbited He's here to solve problems!
  • 24.
  • 25. STOMP* (ActiveMQ, RabbitMQ), IRC and XMPP protocol support.
  • 26. Ready-to-use and cross-browser JavaScript client code.
  • 27. You don't have to reinvent the wheel! [*] http://stomp.codehaus.org/
  • 28.
  • 29.
  • 31. User auth and registration.
  • 33. Sending messages to STOMP server. ...Orbited and jQuery do the rest!
  • 34. Comet web applications with Python, Django & Orbited
  • 35. Comet web applications with Python, Django & Orbited orbited.cfg [global] #reactor=select #reactor=kqueue reactor = epoll proxy.enabled = 1 session.ping_interval = 300 [listen] http://localhost:8080 stomp://localhost:61613 [access] * -> localhost:61613 settings.py # Available using context # processor or templatetag ORBITED_HOST = 'localhost' ORBITED_PORT = 8080 STOMP_HOST = 'localhost' STOMP_PORT = 61613
  • 36. Comet web applications with Python, Django & Orbited Django base template (<head /> tag) <script>document.domain = document.domain;</script> <script src=&quot;{{ ORBITED_MEDIA_URL }}Orbited.js&quot;></script> <script type=&quot;text/javascript&quot;> Orbited.settings.port = {{ ORBITED_PORT }}; Orbited.settings.hostname = &quot;{{ ORBITED_HOST }}&quot;; Orbited.settings.streaming = true; TCPSocket = Orbited.TCPSocket; </script> <script src=&quot;{{ ORBITED_MEDIA_URL }} JSON.js&quot;></script> <script src=&quot;{{ ORBITED_MEDIA_URL }} protocols/stomp/stomp.js&quot;></script>
  • 37. Comet web applications with Python, Django & Orbited <script> $(document).ready(function() { stomp = new STOMPClient(); stomp.onopen = function() { debug('Connected.');}; stomp.onclose = function(c) { debug(Lost Connection, Code: '+c);}; stomp.onerror = function(error){ debug(&quot;Error: &quot; + error);}; stomp.onerrorframe = function(frame){ debug(&quot;Error: &quot; + frame.body);}; stomp.onconnectedframe = function() { {% if game %} stomp.subscribe('/games/{{ game.id }}/status'); stomp.subscribe('/games/{{ game.id }}/players'); {% else %}// subscribe to other channels...{% endif %} }; stomp.onmessageframe = function(frame){ // frame.headers.destination for channel, frame.body for JSON data destpatterns.dispatch(frame); }; stomp.connect('{{ STOMP_HOST }}', {{ STOMP_PORT }}); }); </script>
  • 38. Comet web applications with Python, Django & Orbited Django view @require_POST @login_required def game_start(request, game_id): game = get_object_or_404(Game, id=game_id) if request.user != game.author: return HttpResponseForbidden() try: # start() method set game start_time and send JSON # to ”/games/{{ game.id }}/status” using stomp.py game.start() except GameError, e: return JSONResponse({'error': str(e)}) return JSONResponse({})
  • 39.
  • 40. Comet web applications with Python, Django & Orbited
  • 41. Comet web applications with Python, Django & Orbited
  • 42.