0

我们创建一个使用 XMPP 协议的应用程序。最初我们开始开发并使用一些 XMPP 服务器进行调试。没关系,我们设法通过在本地存储图形文件并在接收用户状态更新时检查文件哈希来防止多余的头像加载。

但是现在我们切换到新的 Openfilere 服务器,它不仅在我们请求 VCard 时不断向我们发送所有可用的用户头像,而且在我们的用户登录后立即使用一些消息:

   <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>

这让我想知道 Openfire 究竟是什么传出消息请求它?还是只是 Openfire 服务器配置为始终向我们发送整个花名册的所有头像图形?

如何解决这个问题,这样我们就不会有这种冗余流量?

以防万一,这些是传出消息:

<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>
4

1 回答 1

1

看起来你试图使用XEP-0084,搞砸了,然后切换到XEP-0153。您可能在您的测试帐户上明确订阅了对一个或多个人的头像的更改,而不是正确实施XEP-0163,这起初可能会让人感到困惑。最简单的解决方法是使用不同的帐户。如果您想清理它,请发送XEP-0060取消订阅协议以响应您获得的每个发布:

<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>
于 2012-03-23T07:49:51.230 回答