0
votes

We create an app that uses XMPP protocol. Initially we started development and used some XMPP server for debug. That was Ok, and we managed to prevent redundant avatar loading by storing graphic files locally and checking the file hash while receiving user Presence update.

But now we switched to new Openfilre server and it keeps sending us all available user avatars not only when we request VCard but also using some message immediately after our user logs in:

   <message id="ca82demo01@fffchat__jason@fffchat__jBUhd" to="jason@fffhat/FFFChat" from="ca82demo01@fffchat">
        <event xmlns="http://jabber.org/protocol/pubsub#event">
            <items node="urn:xmpp:avatar:data">
                <item id="66d0dee0216e5466fe17403f1da16aa39d4e1698">
                    <data xmlns="urn:xmpp:avatar:data">... SOME BIG CHUNK OF DATA ...</data>
            </item>
            </items>
        </event>
        <delay xmlns="urn:xmpp:delay" stamp="2012-03-16T00:00:32.298Z"/>
        <addresses xmlns="http://jabber.org/protocol/address">
            <address jid="ca82demo01@fffchat/53bf00a8" type="replyto"/>
        </addresses>
    </message>

It keeps me wonder what exact outgoing message requests it from Openfire? Or is it just Openfire server configured to always send us all the avatar graphics for entire roster?

How can this be resolved so we won't have this redundant traffic?

Just in case, these are outgoing messages:

<stream:stream to="fffchat.openfire.local" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">

<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

<?xml version="1.0"?>

<stream:stream to="fffchat.openfire.local" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">

<auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>

<response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9Imphc29uIixyZWFsbT0icHBpY2hhdCIsbm9uY2U9ImVhcGVpTlNFZ3NOZzRXRFlsVC9zd1cyLzVWbzMzQWlsYzRvZWFRRFIiLGNub25jZT0iMDBERUFEQkVF

<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">AGphc29uAGFiYzEyMw==</auth>

<?xml version="1.0"?>

<stream:stream to="fffchat.openfire.local" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">

<iq id="_xmpp_bind1" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>PPIChat</resource></bind></iq>

<iq id="_xmpp_session1" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>

<iq id="roster1" type="get"><query xmlns="jabber:iq:roster"/></iq>

<presence><show>chat</show><status>online</status><x xmlns="vcard-temp:x:update"><photo>16286eb46a54fb48d70dc4fbd548bcd16f78cd34</photo></x></presence>

<iq type="get"><query xmlns="jabber:iq:private"><ppidata xmlns="ppi:userdata:favorites"/></query></iq>
1

1 Answers

1
votes

It looks like you were trying to use XEP-0084, messed it up, then switched to XEP-0153. You likely explicitly subscribed to changes to one or more peoples' avatars on your test account, rather than implementing XEP-0163 correctly, which can be quite confusing at first. Easiest fix is to just use a different account. If you want to clean it up, send XEP-0060 unsubscribe protocol in response to each publish that you get:

<iq type='set'
    from='jason@fffhat/FFFChat'
    to='ca82demo01@fffchat'
    id='unsub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
     <unsubscribe
         node='urn:xmpp:avatar:data'
         jid='jason@fffhat'/>
  </pubsub>
</iq>