Using sat-pubsub, a great pubsub component

In the continuity with the previous post about jp, the following article present sat_pubsub, a XMPP Publish-Subscribe (Pubsub) Service Component, build for the need of the « Salut à Toi » project.

Salut à toi (SàT) is a unique XMPP client. As its official description says, it's a "multipurpose, multi front-end, free (libre) and decentralized communication tool". It has been actively developed by Jérôme Poisson (Goffi) and Adrien Cossa (Souliane) since 2008.

sat_pubsub allows us to use our own up-to-date persistent pubsub service.

This article is composed of several sections

Why sat_pubsub ?

There are three main reasons to use sat_pubsub.

First, the XMPP servers come with variable pubsub support. Using an external component allows users to benefits constant features independent of the XMPP server or provider.

Secondly, sat_pubub is the only free (libre) implementation that support Pubsub MAM (Message Archive Management). It allows one to research a pubsub node. This feature is used to research blog post in the database.

Thirdly, sat_pubsub is used to test new functionalities like the ability to restrict blog post to specific group of contacts (think about circles on Google+). [ref]See the following blog post for more information.[/ref].

Let's install it !

This section describes the installation process of sat_pubsub in a python virtualenv. Unfortunately, I have encountered difficulties to install twisted, a dependency of SàT, in a virtualenv with pip because my production machine has no compiler. I managed to avoid the problem by installing python2-twisted (the distribution package) then the virtualenv was created with the option --system-site-packages to give it access to the system packages. Thereafter, it is possible to install sat_tmp, a small python module that monkey patch wokkel, a dependency of sat_pubsub.

$ sudo apt-get install python2-twisted
$ hg clone
$ cd sat_tmp/
$ virtualenv env -ppython2.7 --system-site-packages
$ source env/bin/activate
(env)$  python2 install
(env)$ cd ../
(env)$ hg clone
(env)$ cd sat_pubsub
(env)$ python2 install

Setup the database

According to the official documentation, we need to create the database and install the SQL schema.

$ sudo -u postgres createuser -d -P `whoami`
$ createdb pubsub
$ psql pubsub < sat_pubsub/db/pubsub.sql

Configure Prosody

In order to use sat_pubsub, we need to declare it in our prosody config file. Once again, the information is available in the documentation. Two files need to be modified:

  • /etc/prosody/prosody.cfg.lua
modules_enabled = {
  • /etc/prosody/conf.avail/your_domain.cfg.lua

This file defines the domain configuration of your XMPP server.

This is a copy of the configuration for the agayon server. The pubsub component is available at the address The following configuration:

  • enables pubsub MAM,
  • uses the component for microblogging activity,
  • announces the pubsub nodes and items in disco requests,
  • lets the component access the roster and presence informations (used for PEP).
VirtualHost ""
    enabled = true
    privileged_entities = {

            [""] = {
            roster = "get";
            message = "outgoing";
            presence = "roster";
    delegations = {
                ["urn:xmpp:mam:1"] = {
                        filtering = {"node"};
                        jid = "";
                 [""] = {
                        jid = "";
                 [""] = {
                        jid = "";
                 ["https://salut-a-toi/protocol/schema:0"] = {
                        jid = "";
                 ["*"] = {
                        jid = "";

Component ""
        component_secret = "shared_secret"
        modules_enabled = {"delegation", "privilege"}


(env)$ twistd  sat_pubsub --secret=shared_secret --rhost= \
--rport=5347 --backend=pgsql --dbuser=user --dbpass=pass_psql --dbname=pubsub --dbhost=localhost --dbport=5432

Let's use it !

Once prosody is restarted, the component is accessible through any XMPP client. See the following example with jp.

$ jp info disco -c


│catego  type     name                      │
│pubsub  service  Salut à Toi pubsub service│


│entity            node               │
│  be.agayon.errol:0  │
│  tests              │
│  Agayon             │

The following commands are used to create a node, subscribe to it and edit an item (see the previous article).

$ jp pubsub node create -s -n node_name
$ jp pubsub subscribe -s -n node_name
$ jp pubsub edit -s -n node_name

The default text editor is then opened. It is possible to directly edit a XML file. This command is useful for debugging purpose.

About Agayon XMPP service

All the tests described in this blog are realized on the XMPP service. It is not opened for registration but having this field of experimentation is great to learn, practice and question the potential uses of XMPP. I use it with several accounts, depending on my use:

Most moderns XEPs are enabled in order to provide an up-to-date experience: PEP, Carbon, Stream Management, persistent pubsub, MAM, SRV records over TLS (useful to pass blocking WiFi accesses), etc.

Future of SàT

In a near future, the SàT project will make great announcements about new uses of pubsub. I hope this article will make you want to install sat_pubsub and experiment with nodes, data and notifications.

Stay tuned !