[ejabberd] Creating bot that can create nodes on the fly and publish data using pubsub

kael ka-el at laposte.net
Tue May 11 21:14:57 MSD 2010

On 05/08/2010 01:07 AM, shahzad bhatti wrote:
> I am trying to create a quote server using Ejabberd and pubsub. I would 
> like the clients to subscribe to a symbol, which would be mapped to the 
> node. On the server side, I would like a way to create nodes for the 
> symbol (if they don't already exist) be created automatically but 
> securely. Basically, I would like to create a bot that detects there is 
> a subscriber for a symbol and automatically create node (if doesn't 
> exist) and start publishing quote data for the subscribers. And when 
> there are no subscribers, I would like the bot to stop sending the data. 

It is possible for node owners to be notified when a user subscribes and 
unsubscribes by setting the 'pubsub#notify_sub' = 'true' node option.

It is not currently implemented in ejabberd 2.1.3 so I wrote a patch 

With exmpp, you'd have to use 
exmpp_client_pubsub:create_and_configure_node/3 or 
exmpp_client_pubsub:set_node_configuration/3 to set that option with an 
#xmlel{name = 'x', ns = ?NS_DATA_FORMS} containing the corresponding field.

Regarding the possibility of creating a node based on subscriptions, it 
is not possible. The node has to exist beforehand to handle 
subscriptions, otherwise the server replies with an error message.


More information about the ejabberd mailing list