对XMPP协议中Service Discovery协议的研究

协议参考XEP-0030

在发送了initial presence以后,SDK发送disco#items,查询server所支持的components;

Send:
<iq to='jabber.org' id='conid8' type='get'>
  <query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>

client收到server返回的components列表;

Recv:
<iq from='jabber.org' id='conid8' to='[email protected]' type='result' xml:lang='en'>
  <query xmlns='http://jabber.org/protocol/disco#items'>
    <item jid='grohe.com'/>
    <item jid='conference.isj1.jabber.com'/>
    <item jid='regimentcapital.com'/>
    <item jid='consvr.isj1.jabber.com'/>
    <item jid='proxy.isj1.jabber.com'/>
    <item jid='jda.com'/>
    <item jid='aol-address-mapper.isj1.webex.com'/>
  </query>
</iq>

client向每一个component发送disco#info查询信息,目的是为了明确每个component的身份和作用;

Send:
<iq to='conference.isj1.jabber.com' id='conid10' type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

client收到server返回的某一个component的disco#info结果,我们可以看出,下面举例的是MUC server。从identity和支持的feature中判断;

Recv:
<iq from='conference.isj1.jabber.com' id='conid10' to='[email protected]' type='result' xml:lang='en'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <identity category='conference' name='Text Conferencing' type='text'/>
    <feature var='http://jabber.org/protocol/disco#info'/>
    <feature var='groupchat'/>
    <feature var='gc-1.0'/>
    <feature var='http://jabber.org/protocol/muc'/>
  </query>
</iq>

你可能感兴趣的:(对XMPP协议中Service Discovery协议的研究)