= 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 soon). However, we strongly discourage any production application using a regular client.
== FEATURES/PROBLEMS:
Please link "report/request here.":http://github.com/julien51/babylon/issues
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 :
- Implement the ServerConnection for S2S
- Implement templates for disco-info... and common XEPs
- Delete route priorities? And rely on the order only? (As Rails does)
- Review doc
- 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":http://babylon.rubyforge.org/
Feel free to fork the "github":http://github.com/julien51/babylon/tree/master repo and add some documentation if you think anything is missing.
You can't be a bad coder, a bad tester and a bad documenter at the same time ;)
== 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:
-
Install the gem
-
The app contains a generator that will "build" a scaffold for your application.
$> babylon application myapp
-
Use the generator or write your own controllers :
$> babylon controller messages echo:10://stream:message[@type='chat']/body,subscribed:0://stream: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 implementing 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
-
Customize your controllers, stanzas and views!
-
Make sure that the XMPP settings are correct in config/config.yaml.
-
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 : http://github.com/julien51/babylon/tree/master
== REQUIREMENTS :
Gems : Eventmachine, nokogiri (please, use build from the guthub repo, since 1.2.3 is not supported by Babylon), YAML, log4r, sax-machine, templater, daemons
== LICENSE:
(The MIT License)
Copyright (c) 2009 Julien Genestoux http://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.