Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Skates (ex-Babylon) is a framework to build EventMachine based XMPP External Components in Ruby.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 templates
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 skates.gemspec
README.rdoc

Skates

DESCRIPTION:

Skates 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.”:github.com/julien51/skates/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 Skates!

DOCUMENTATION :

You can find it on our “Rubyforge page”:skates.rubyforge.org/ Feel free to fork the “github”:github.com/julien51/skates/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 Skates, or you can use the Skates::ClientConnection and Skates::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 Skates:

  1. Install the gem

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

    $> skates application __myapp__
  3. Use the generator or write your own controllers :

    $> skates 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

  1. Customize your controllers, stanzas and views!

  2. Make sure that the XMPP settings are correct in config/config.yaml.

  3. And finally start the component :

    script/component
  4. We running in production, you may run the script/component too, but with something like runit to deamonize the process.

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

Skates::ClientConnection.connect(params, handler) or, Skates::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!

Skates's edge versions are located at Github : github.com/julien51/skates/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.

Something went wrong with that request. Please try again.