Skip to content
Kenneth Kalmer edited this page Jun 5, 2011 · 1 revision

The XMPP generator creates a simple daemon that leverages the blather gem to process inbound messages. The daemon will manage the roster and other little tasks, leaving you to provide the hooks for processing messages, presence notifications and subscription request.

Dependencies

The Gemfile of the generated daemon resolves this dependency.

Configuration

The configuration happens in config/xmpp.yml, and looks something like this:

defaults: &defaults
  jabber_id: dk@jabber
  password: secret
  resource: daemon_kit
  enable_logging: false
  masters: 
    - [email protected]
  supporters:
    - [email protected]

development:
  <<: *defaults

test:
  <<: *defaults

production:
  <<: *defaults

The configuration specifies the following keys:

  • jabber_id - Identidy (username) of the user
  • password - Password used to authenticate
  • resource - Multiple connections can be made with the same credentials and different resources
  • masters - Array of Jabber ID's whose messages will be processed
  • supporters - Additional 'buddies' to keep on roster, but messages won't be processed
  • enable_logging - Enable Blather logging (VERY VERBOSE)
  • require_master - Disable filtering of messages based on the sender being a 'master'

Usage

A template daemon is provided in libexec/<name>\_daemon.rb. The DaemonKit::XMPP provides the context of Blather::Client, and you can use the Blather DSL within that block.

Clone this wiki locally