[ejabberd] PubSub subscription problem

kael ka-el at laposte.net
Tue Apr 20 21:57:45 MSD 2010


On 04/20/2010 01:16 PM, Boris Okner wrote:
> Here is a problem: ejabberd doesn't yet remove subscriptions for 
> resources that went offline. So what happens is that all such stale 
> subscriptions get transferred to a still active resources of the same 
> account. Without knowing SubId, it's hard to filter out all that noise.  
> Is it possible that you keep SubID for the time being until above 
> problem is solved?

Alternatively, the solution is to create and configure a node (or simply 
to configure it) with the following parameter :

<iq type='set' to='pubsub.localhost'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
   <create node='feeds.Temperature.sensor1.devices'/>
   <configure>
    <x xmlns='jabber:x:data' type='submit'>
     <field var='FORM_TYPE' type='hidden'>
      <value>http://jabber.org/protocol/pubsub#node_config</value>
     </field>
     <field var='pubsub#presence_based_delivery'>
      <value>true</value>
     </field>
    </x>
   </configure>
  </pubsub>
</iq>


Then, the subscription has to be done with a full JID :

<iq type='set' to='pubsub.localhost'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
   <subscribe node='feeds.Temperature.sensor1.devices'
              jid='joe at localhost/25353072781271737576681426'/>
  </pubsub>
</iq>

This way, messages are sent only to the available resources.


But there's a bug with 'pubsub#presence_based_delivery'. I wrote a patch 
(attached) to fix this bug for ejabberd 2.1.3.

Copy the patch into src/mod_pubsub/, then :

$ cd src/mod_pubsub/
$ patch -p0 < mod_pubsub.patch


So now with 'pubsub#presence_based_delivery' = 'true', available 
resources should only receive messages sent to them, except in the case 
of subscriptions with a bare JID, in which case each available resource 
will receive a message.

-- 
kael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mod_pubsub.patch
Type: text/x-patch
Size: 918 bytes
Desc: not available
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20100420/dc9fcabb/attachment.bin>


More information about the ejabberd mailing list