【问题标题】:Why does the XMPP server ignore my subscribe with nickname request?为什么 XMPP 服务器会忽略我的昵称订阅请求?
【发布时间】:2015-06-29 21:57:48
【问题描述】:

我正在尝试通过 Strophe.js (1.2.0) 向 XMPP 服务器 (OpenFire 3.9.3) 发送订阅请求。

<presence type="subscribe" from="agent@localhost" to="agent3@localhost" xmlns="jabber:client">
<nick xmls="http://jabber.org/protocol/nick">agent3</nick>
</presence>

名册项目已创建,但没有昵称。

Openfire 调试日志:

2015.04.22 11:57:43 XMPPServlet - 447b9ca3ad42f7bc78e09d35b882dfb3 : onMessage : Received : <presence type='subscribe' from='agent@localhost' to='agent3@localhost' xmlns='jabber:client'><nick xmls='http://jabber.org/protocol/nick'>agent3</nick></presence> 
2015.04.22 11:57:43 XMPPServlet - 447b9ca3ad42f7bc78e09d35b882dfb3 : Delivered : <iq type="set" id="232-173" to="agent@localhost/f0ddfe38-7bdd-fc6b-04a7-e63a7e30bf89"><query xmlns="jabber:iq:roster"><item jid="agent3@localhost" ask="subscribe" subscription="none"/></query></iq>

【问题讨论】:

    标签: xmpp openfire strophe


    【解决方案1】:

    在订阅请求中包含昵称只是为了向收件人提供额外的信息(“这个想要添加我的人是谁?”),而不是在花名册中设置昵称。要设置花名册项目的昵称,您需要在发送订阅请求之前或之后发送花名册设置请求:

    <iq type='set' id='roster_3'>
      <query xmlns='jabber:iq:roster'>
        <item jid='agent3@localhost' name='agent3'/>
      </query>
    </iq>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-21
      • 2017-06-25
      • 2016-04-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-15
      • 2023-02-14
      相关资源
      最近更新 更多