powered by Jive Software

[BUG] Pubsub forget to notify offline subscribers

Hello everyone

I’m working on a PHP pubsub implementation with Openfire ! (awesome work guys )

but I have a little problem here.

Offline classics messages are send to my user when is login, but if the message is a pubsub one (someone publish an item when I was offline), when i’m login I don’t receive the message !

This behavior is unexpected,

also when an user publish item when i’m online, there is no problem and my user receive his message notification, with payload etc…

Here some xml for you but don’t think there will help you to help me

When my Drupal user is Publishing content :
1228496819 [VERBOSE]: SENT: <iq type='set'
               from='drupal@dalexandre-laptop/xmpphp'
               to='pubsub.dalexandre-laptop'
               id='publish1'>
                  <pubsub xmlns='http://jabber.org/protocol/pubsub'>                     <publish node='article'>
                      <item>
                        <entry xmlns='http://www.w3.org/2005/Atom'>
                          <title>Mon 5eme article</title>
                          <content>Mon texte 5 !</content>
                          <id>identifiantunique7691</id>
                          <updated>2008-12-05T18:06:59+01:00</updated>                         </entry>
                      </item>
                    </publish>
                  </pubsub>
                </iq>
1228496819 [VERBOSE]: Successfully sent 746 bytes.
1228496819 [VERBOSE]: RECV: <iq type="result" id="publish1" from="pubsub.dalexandre-laptop" to="drupal@dalexandre-laptop/xmpphp"/>
1228496819 [VERBOSE]: RECV: <message from="pubsub.dalexandre-laptop" to="drupal@dalexandre-laptop" id="article__drupal@dalexandre-laptop__9WI7t"><event xmlns="http://jabber.org/protocol/pubsub#event"><items node="article"><item id="VvvDw1ag53xmSwW"><entry xmlns="http://www.w3.org/2005/Atom">
                          <title>Mon 5eme article</title>
                          <content>Mon texte 5 !</content>
                          <id>identifiantunique7691</id>
                          <updated>2008-12-05T18:06:59+01:00</updated>
                        </entry></item></items></event><headers xmlns="http://jabber.org/protocol/shim"><header name="pubsub#subid">yKOb860kQz5068VBDYLy7sktjnTxIwIxuvx2SW4g</header></headers></message>
1228496819 [DEBUG]: Calling message_handler

Then, the owner receive a message, but now if I connect a subscriber, he doesn’t receive it.

Also I have a strange result here (I want to show my subscriptions, I subscribe only to the article node but it seem to be many) :

1228497122 [VERBOSE]: SENT: <iq type='get'
                   from='dalexandre@dalexandre-laptop/xmpphp'
                   to='pubsub.dalexandre-laptop'
                   id='subscriptions1'>
                  <pubsub xmlns='http://jabber.org/protocol/pubsub'>                     <subscriptions/>
                  </pubsub>
                </iq>
1228497122 [VERBOSE]: Successfully sent 324 bytes.
1228497122 [VERBOSE]: RECV: <iq type="result" id="subscriptions1" from="pubsub.dalexandre-laptop" to="dalexandre@dalexandre-laptop/xmpphp"><pubsub xmlns="http://jabber.org/protocol/pubsub">
                    <subscriptions><subscription node="article" jid="dalexandre@dalexandre-laptop/xmpphp" affiliation="none" subscription="subscribed" subid="TSL17uLGiGePQAfnQ30Lss3z366TCFBs103f8MVP"/><subscription node="article" jid="dalexandre@dalexandre-laptop/xmpphp" affiliation="none" subscription="subscribed" subid="ts686lHIKLtwnWPAcv9cf0180YcPaN300BIHvPfd"/><subscription node="article" jid="dalexandre@dalexandre-laptop/xmpphp" affiliation="none" subscription="subscribed" subid="5Oaf0KGiibGvN16gDwqM7lIL7m1YgM3E6VfYGs27"/></subscriptions>
                  </pubsub></iq>

Thanks a lot for your help !

Bye!

Ce message a été modifié par: dalexandre

Hi all,

I have some others infos about my issue,

the pubsub#persist_items configuration option was to false, I’ve set it to true on a brand new node.

But it’s always the same : If my subscriber is offline, he will never got the new item.

My pubsub#presence_based_delivery is correctly set to False too.

I don’t see what else to do

Thx for your time !

Same problem here. I read in the XEP 60 (http://xmpp.org/extensions/xep-0060.html) that sending notifications to offline subscribers can be understood as optional :

12.4 Presence-Based Delivery of Events

Implementations of pubsub MAY deliver event notifications only when the subscriber is online. In these cases, the option may be a node configuration option as shown in the examples above. To facilitate this, the pubsub service needs to subscribe to the subscriber’s presence and check the subscriber’s current presence information before sending any event notifications (as described in RFC 3921). Presence subscriptions MUST be based on the subscribed JID.

Does Openfire implements sending pubsub notification to offline users ?

Pfeew, finally found a solution. The OfflineMessageStore class ignores “empty-bodied” messages (line 113, addMessage() method. Commenting out the line fixes the issue.

It seems that such “empty” messages are ignored in order to prevent status updates to be delivered to reconnecting users. There’s maybe a better way to detect such “useless” messages than testing message’s body size ?

I guess this makes the discussion a bug report

Hi Tristan,

I wonder wheter I should create an issue for this. The comment within the source code indicates that chat-state notifications should be dropped. I think that this code should not be completely removed. Do you think that somethink like this will also work?

if (message.getBody() == null || message.getBody().length() == 0) {

// ignore empty bodied message (typically chat-state notifications).

// but keep pubsub messages

if ( ... )

{

    // pubsub message, keep it

} else {

      return;

};

};

LG

i think an issue should be created for this, and that your fix is better than mine

though, i’m thinking that it’s the code responsible for keeping / dropping empth bodied message could be abstracted in xep implementation (pubsub module, etc).

http://www.igniterealtime.org/issues/browse/JM-1508 to track it, JM-1508

Thanks a lot for creating the issue.

Could you please provide the full addMessage method or at least the whole relevant part in code, please? Especially what is to insert into

// pubsub message, keep it

I found your fix but the “return” means that it will not be kept right?

http://issues.igniterealtime.org/browse/OF-191?page=com.atlassian.jira.plugin.sy stem.issuetabpanels:all-tabpanel

if (message.getBody() == null || message.getBody().length() == 0) {

// ignore empty bodied message (typically chat-state notifications).

// but not pubsub messages

if(message.getChildElement(“event”, “http://jabber.org/protocol/pubsub#event”) == null){ return; }

}

This whole part in code would be very helpful! Thanks!