Babylon is a framework to build EventMachine based XMPP External Components in Ruby.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 73 commits ahead, 1 commit behind theball:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.rdoc

Babylon

DESCRIPTION:

Babylon is a framework to build XMPP Applications in Ruby. The framework uses EventMachine to handle network connections.

This framework can use both an XMPP Component (XEP-0114) and an XMPP Client (and XMPP Servers should come soone). However, we strongly discourage any production application using a regular client.

FEATURES/PROBLEMS:

Please report/request them at the Lighthouse : babylon.lighthouseapp.com/projects/27641-babylon/overview

The current version is a good candidate for version 0.1. We will probably not add any important features before that release, but we need some help with the tests and documentation.

ROADMAP :

  • Improve the Client Connection to support other authentication than PLAIN SASL

  • Implement the ServerConnection for S2S

  • Implement “auto-responding” features for disco-info… etc

  • Use a better generator (the next version of Nokogiri should fix that)

  • Implement “background” running when in production (and adjust log level)

  • Delete route priorities? And rely on the order only? (As Rails does)

  • Review doc

  • Write more spec

  • Write tests

  • Evangelize!

You can help with at least one of these points, don't turn your back on Babylon!

DOCUMENTATION :

You can find it on our Rubyforge page : babylon.rubyforge.org/ Please note that the documentation is probably incomplete… so if you have any problems with something that is not clear enough to you, feel free to send us questions and do not hesitate to fork the project to add your own documentation. We will be more than happy to help you help us!

SYNOPSIS :

You can build applications directly with Babylon, or you can use the Babylon::ClientConnection and Babylon::ComponentConnection to create simple apps, but you will then have to handle stanza routing and creation yourself. You can also use these classes in external gems.

To create an Application with Babylon:

  1. Install the gem

  2. The app contains a generator that will “build” a scaffold for your application.

    $> babylon application <myapp>
  3. Use the generator or write your own controllers :

    $> babylon controller messages echo:10://message[@type='chat']/body,subscribed:0://presence[@type='subscribe']

This will generate a “MessagesController” class with 2 methods : echo and subscribed.

- "echo" will be called when the component receives message stanzas of type 'chat', 
- "subscribed" will be called for presence stanzas of type 'subscribe'.

10 and 0 are the priority : useful when a stanza matches 2 XPath.

Each of these actions will be called with stanza objects. You have to define your own objects in stanzas/echo.rb and stanzas/subscribed.rb By defining them, you can choose which elements and attributes you want to have access to. These attributes will be populated upon instantiation of the Stanza objects.

This will also generate 2 'views' used to build your responses stanzas.

And finally, this will write 2 routes in the config/routes.rb

  1. Customize your controllers, stanzas and views!

  2. Make sure that the XMPP settings are correct in config/config.yaml. !!! You need to have a Jabber Component, regular clients will NOT work!!!

  3. And finally start the component :

    script/component

To use the Connection Classes only (Client or Component), you can just call the following :

Babylon::ClientConnection.connect(params, handler) or, Babylon::ComponentConnection.connect(params, handler)

where params is a hash for all the necessary information to connect, and handler is an object that will receive the callbacks. Right now 3 callbacks are supported:

on_connected(connection), on_disconnected and on_stanza(stanza)

ADDITIONAL INFORMATION :

Feel free to pull, branch, improve and commit the {code|specs|tests|docs} : we will merge it if it's a step ahead!

Babylon's edge versions are located at Github : github.com/julien51/babylon/tree/master

REQUIREMENTS :

Gems : Eventmachine, nokogiri, YAML, log4r, sax-machine, templater

LICENSE:

(The MIT License)

Copyright © 2009 Julien Genestoux notifixio.us

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.