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:
-
- Start your XMPP server and create an account for your web application user.
- In your Ruby application, use ruby_bosh to initialize a new BOSH session using the user’s xmpp username and password.
- Pass the identifiers returned from ruby_bosh to your template engine as variables.
- Bind the template variables to Javascript variables.
- 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.