<b>ruby_bosh</b> - an XMPP BOSH session initializer

By Pradeep Elankumaran March 1, 2009 in rails, ruby, plugin, gem, xmpp, web2.0, bosh

Hot on the heels of my post on why XMPP will be huge, here’s a ruby library to pre-initialize BOSH sessions in your Ruby web applications. This feature allows you to by-pass exposing your user’s XMPP credentials in your HTML views.


The process follows as such:


  1. Start your XMPP server and create an account for your web application user.

  2. In your Ruby application, use ruby_bosh to initialize a new BOSH session using the user’s xmpp username and password.

  3. Pass the identifiers returned from ruby_bosh to your template engine as variables.

  4. Bind the template variables to Javascript variables.

  5. Use a Javascript-based BOSH connector (like Strophe) to attach to the pre-existing session using the identifiers.

There are many XMPP servers and BOSH connection managers out there, but as of now this library has only been tested with eJabberd 1.2+. Please feel free to fork and submit a pull request if you’d like to contribute.


The plugins and documentation can be found at: http://www.github.com/skyfallsin/ruby_bosh


Jack Moffit’s written a Django/Python example here.

blog comments powered by Disqus