SlideShare uma empresa Scribd logo
1 de 27
Fast, Scalable
Front/Back-end Services
  using Ruby, Rails and
         XMPP
    Pradeep Elankumaran
      pradeep@intridea.com
       twitter: @pradeep24
What is XMPP?
•   eXtensible Messaging and Presence Protocol

•   Message-oriented middleware

•   XML-based

•   Various XMPP servers (eJabberd, Openfire, Tigase)

•   Most known for being the backend for IM systems

•   xmpp.org
The GOOD
• Open
• Standardized by the IETF
• Decentralized
• Mature
• Customizable
• FAST!
The BAD
• XML is very verbose
• Documentation is not outlined properly
    •   though there are efforts to make this better

•   Lots of presence data overhead on larger
    networks
•   No unmodified binary data transfers
A Simple XMPP Stanza
                      JID         resource


 <message from=’pradeep@xmpp.org/adium’
     to=’zana@xmpp.org’>
  <body>This is a message</body>
 </message>
Some XMPP Features
• Presence
• Instant Messaging
• Publish/Subscribe
• Multi-User Chat
• Federation
• Personal Eventing, and many more...
The Future
Publish/Subscribe
         <iq type=’set’ to=’pubsub.xmpp.org’
         from=’me@xmpp.org’>
            <pubsub xmlns=’http://jabber.org/protocol/pubsub’>
             <publish node=’apples’>
              <item>Fuji Apples</item>
node name                                                the pubsub namespace
             </publish>
            </pubsub>
         </iq>




   subscriber                                            subscriber

                               subscriber
Publish / Subscribe
• Federated Microblogging using the Personal
  Eventing Protocol (PEP)
• Real-time search
• Real-time topic-tracking via multiple
  communication channels (RSS, IM etc.)
• Real-time collaborative editing
Real-time User Interfaces
• BOSH
• Robust, lively interfaces for daily use
• Javascript-based XMPP clients
• Handlers attached to various XMPP stanzas
• Present.ly, drop.io
The Backend
XMPP4R
•gem install ln-xmpp4r
• very full-featured
• threaded, event-based
• BAD: a lack of documentation, steep
  learning curve
• Interfacing with Rails app requires an
  external daemon
strophe-ruby
• gem install yong-stropheruby
• based off libstrophe, a C library
• event-based
• can be run within a Rails app with proper
  timeouts and exception handling
• new release soon
• LOOKING FOR CONTRIBUTORS!
The Front-End
BOSH
•   Bi-directional streams Over Synchronous HTTP

•   This is not COMET, which requires a single
    persistent connection

•   Session persists over multiple connections

•   Full-formed HTTP requests, so works with
    most proxies
BOSH
client   <body/>, session


                      BOSH
                    connection   no <body/>
                     manager
                                         XMPP
                                         server
Strophe
• Excellent Javascript BOSH client
• written by Jack Moffit (metajack.im)
• written for Chesspark
• used in production at Present.ly
• very, very awesome.
Strophe
connection = new Strophe.Connection(“/http-bind”);
connection.connect(“pradeep@xmpp.org”, “password”,
           onConnect);

// this calls onMessage for each <message/> stanza
connection.addHandler(onMessage, null, ‘message’,
                      null, null, null);

// this calls onPubsubEvent every time there’s a message
// from a PubSub node
connection.addHandler(onPubsubEvent,
 'http://jabber.org/protocol/pubsub#event', 'message',
  null, null, null);
An Example
Present.ly (before)
    Client

             jQuery, polling



     Rails                      Custom Index




                           DB


   Supporting
    Daemons
we needed
something better
Present.ly (now)
                                  BOS
                                       H, st
             Client                          rophe-
                                                   js



                                                    BOSH
                                              connection manager
 Rails
                      str
                         op
                           he
                              -ru
                                  by




                                                        eJabberd

                DB
Supporting
 Daemons
scales beautifully
demo time
XMPP Servers
• eJabberd
   • written in Erlang, highly scalable, actively maintained
   • runs in production on Present.ly, Chesspark
• Jabberd2
   • written in C, actively maintained
• Tigase
   • written in Java, actively maintained
   • runs in production on Seesmic
• Openfire
   • written in Java, actively maintained
   • large community, lots of plugins. good for basic XMPP apps
• Prosody
   • written in Lua, very new, claims to be lightweight
Questions?
 pradeep@intridea.com
  twitter: @pradeep24
  http://www.skyfallsin.com

Mais conteúdo relacionado

Mais procurados

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
oscon2007
 
Jabber is more than instant messaging
Jabber is more than instant messagingJabber is more than instant messaging
Jabber is more than instant messaging
Florian Holzhauer
 
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!
Daniel Londero
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
Zoran Jeremic
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
Lance Ball
 

Mais procurados (20)

Ruby Meets Cocoa
Ruby Meets CocoaRuby Meets Cocoa
Ruby Meets Cocoa
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
Jabber is more than instant messaging
Jabber is more than instant messagingJabber is more than instant messaging
Jabber is more than instant messaging
 
Camel and JBoss
Camel and JBossCamel and JBoss
Camel and JBoss
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torquebox
 
Crash course to the Apache Camel
Crash course to the Apache CamelCrash course to the Apache Camel
Crash course to the Apache Camel
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for Ruby
 
RabbitMQ Operations
RabbitMQ OperationsRabbitMQ Operations
RabbitMQ Operations
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
UltraESB - an introduction
UltraESB - an introductionUltraESB - an introduction
UltraESB - an introduction
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
 
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Introduction to AtomPub Web Services
Introduction to AtomPub Web ServicesIntroduction to AtomPub Web Services
Introduction to AtomPub Web Services
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of Ruby
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
 

Destaque (10)

Encuesta al Bar Spartan
Encuesta al Bar SpartanEncuesta al Bar Spartan
Encuesta al Bar Spartan
 
Portfolio_JIYONG_YOO
Portfolio_JIYONG_YOOPortfolio_JIYONG_YOO
Portfolio_JIYONG_YOO
 
Ungdom Og Media
Ungdom Og MediaUngdom Og Media
Ungdom Og Media
 
Presentacion Tecnociencia
Presentacion TecnocienciaPresentacion Tecnociencia
Presentacion Tecnociencia
 
Información familias
Información familiasInformación familias
Información familias
 
Pastor
PastorPastor
Pastor
 
Act5 unidad-2
Act5 unidad-2Act5 unidad-2
Act5 unidad-2
 
Camilo Herrera - Un litro de luz
Camilo Herrera - Un litro de luzCamilo Herrera - Un litro de luz
Camilo Herrera - Un litro de luz
 
Soñamos los robots del futuro
Soñamos los robots del futuroSoñamos los robots del futuro
Soñamos los robots del futuro
 
Felipe games
Felipe gamesFelipe games
Felipe games
 

Semelhante a Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP

Microblogging via XMPP
Microblogging via XMPPMicroblogging via XMPP
Microblogging via XMPP
Stoyan Zhekov
 
JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5
Stephan Schmidt
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
Amit Solanki
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
Joseph Scott
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
oscon2007
 
Flickr Architecture Presentation
Flickr Architecture PresentationFlickr Architecture Presentation
Flickr Architecture Presentation
web25
 
Messaging With Erlang And Jabber
Messaging With  Erlang And  JabberMessaging With  Erlang And  Jabber
Messaging With Erlang And Jabber
l xf
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 Notes
Ross Lawley
 
ruote stockholm 2008
ruote stockholm 2008ruote stockholm 2008
ruote stockholm 2008
John Mettraux
 

Semelhante a Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP (20)

Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289
 
Microblogging via XMPP
Microblogging via XMPPMicroblogging via XMPP
Microblogging via XMPP
 
Qcon
QconQcon
Qcon
 
JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Rails
 
I35s
I35sI35s
I35s
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Web Development: The Next Five Years
Web Development: The Next Five YearsWeb Development: The Next Five Years
Web Development: The Next Five Years
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
 
Node.js: CAMTA Presentation
Node.js: CAMTA PresentationNode.js: CAMTA Presentation
Node.js: CAMTA Presentation
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
 
Flickr Architecture Presentation
Flickr Architecture PresentationFlickr Architecture Presentation
Flickr Architecture Presentation
 
Samza portable runner for beam
Samza portable runner for beamSamza portable runner for beam
Samza portable runner for beam
 
Messaging With Erlang And Jabber
Messaging With  Erlang And  JabberMessaging With  Erlang And  Jabber
Messaging With Erlang And Jabber
 
Vidoop CouchDB Talk
Vidoop CouchDB TalkVidoop CouchDB Talk
Vidoop CouchDB Talk
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 Notes
 
ruote stockholm 2008
ruote stockholm 2008ruote stockholm 2008
ruote stockholm 2008
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPath
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP

  • 1. Fast, Scalable Front/Back-end Services using Ruby, Rails and XMPP Pradeep Elankumaran pradeep@intridea.com twitter: @pradeep24
  • 2.
  • 3. What is XMPP? • eXtensible Messaging and Presence Protocol • Message-oriented middleware • XML-based • Various XMPP servers (eJabberd, Openfire, Tigase) • Most known for being the backend for IM systems • xmpp.org
  • 4. The GOOD • Open • Standardized by the IETF • Decentralized • Mature • Customizable • FAST!
  • 5. The BAD • XML is very verbose • Documentation is not outlined properly • though there are efforts to make this better • Lots of presence data overhead on larger networks • No unmodified binary data transfers
  • 6. A Simple XMPP Stanza JID resource <message from=’pradeep@xmpp.org/adium’ to=’zana@xmpp.org’> <body>This is a message</body> </message>
  • 7. Some XMPP Features • Presence • Instant Messaging • Publish/Subscribe • Multi-User Chat • Federation • Personal Eventing, and many more...
  • 9. Publish/Subscribe <iq type=’set’ to=’pubsub.xmpp.org’ from=’me@xmpp.org’> <pubsub xmlns=’http://jabber.org/protocol/pubsub’> <publish node=’apples’> <item>Fuji Apples</item> node name the pubsub namespace </publish> </pubsub> </iq> subscriber subscriber subscriber
  • 10. Publish / Subscribe • Federated Microblogging using the Personal Eventing Protocol (PEP) • Real-time search • Real-time topic-tracking via multiple communication channels (RSS, IM etc.) • Real-time collaborative editing
  • 11. Real-time User Interfaces • BOSH • Robust, lively interfaces for daily use • Javascript-based XMPP clients • Handlers attached to various XMPP stanzas • Present.ly, drop.io
  • 13. XMPP4R •gem install ln-xmpp4r • very full-featured • threaded, event-based • BAD: a lack of documentation, steep learning curve • Interfacing with Rails app requires an external daemon
  • 14. strophe-ruby • gem install yong-stropheruby • based off libstrophe, a C library • event-based • can be run within a Rails app with proper timeouts and exception handling • new release soon • LOOKING FOR CONTRIBUTORS!
  • 16. BOSH • Bi-directional streams Over Synchronous HTTP • This is not COMET, which requires a single persistent connection • Session persists over multiple connections • Full-formed HTTP requests, so works with most proxies
  • 17. BOSH client <body/>, session BOSH connection no <body/> manager XMPP server
  • 18. Strophe • Excellent Javascript BOSH client • written by Jack Moffit (metajack.im) • written for Chesspark • used in production at Present.ly • very, very awesome.
  • 19. Strophe connection = new Strophe.Connection(“/http-bind”); connection.connect(“pradeep@xmpp.org”, “password”, onConnect); // this calls onMessage for each <message/> stanza connection.addHandler(onMessage, null, ‘message’, null, null, null); // this calls onPubsubEvent every time there’s a message // from a PubSub node connection.addHandler(onPubsubEvent, 'http://jabber.org/protocol/pubsub#event', 'message', null, null, null);
  • 21. Present.ly (before) Client jQuery, polling Rails Custom Index DB Supporting Daemons
  • 23. Present.ly (now) BOS H, st Client rophe- js BOSH connection manager Rails str op he -ru by eJabberd DB Supporting Daemons
  • 26. XMPP Servers • eJabberd • written in Erlang, highly scalable, actively maintained • runs in production on Present.ly, Chesspark • Jabberd2 • written in C, actively maintained • Tigase • written in Java, actively maintained • runs in production on Seesmic • Openfire • written in Java, actively maintained • large community, lots of plugins. good for basic XMPP apps • Prosody • written in Lua, very new, claims to be lightweight
  • 27. Questions? pradeep@intridea.com twitter: @pradeep24 http://www.skyfallsin.com

Notas do Editor