compp

Compp is Comet and XMPP. It will probably remind you of BOSH but is much simpler. It’s an easy way to turn any any incoming XMPP messages into a comet stream.

Usage

Install

sudo gem install compp

Start

This will start a the server with a default behavior of putting any message stanza received down to the Comet connection

Compp.start(Compp::Default, {:host => '0.0.0.0', :port => 8000})

You can also customize more your server :

class MyCompp < Compp::Default
  ##
  # This example just 
  def register_xmpp_handlers(connection)
    connection.register_handler :message  do |m|
      status = m.xpath("//message/ps:event/sf:status", {"ps" => "http://jabber.org/protocol/pubsub#event", "sf" => "http://superfeedr.com/xmpp-pubsub-ext"}).first
      if !status.nil?
        feed        = status["feed"]
        http_code   = status.xpath("./sf:http/@code", {"sf" => "http://superfeedr.com/xmpp-pubsub-ext"}).first
        msg_status  = status.xpath("./sf:http",       {"sf" => "http://superfeedr.com/xmpp-pubsub-ext"}).first.text
        orbitize("#{feed} => #{http_code} (#{msg_status})")
      end
    end
  end
end
# Starts the server 
Compp.start(MyCompp, {:host => '0.0.0.0', :port => 8000})

Check out example.rb for more.

Author

Julien ([email protected])

License

Compp

Copyright © 2009 Superfeedr

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.