节目通信流程

备注:
1001:节目id
9001:用户id
[email protected]/Spark 2.6.3:用户jid
conference.im.lanmei.fm:节目绑定域(固定)


1、获取节目详情
c req:


<iq id="NyPcU-43" from="[email protected]/Spark 2.6.3"  to="[email protected]" type="get">
<query xmlns="http://jabber.org/protocol/disco#info">
</query>
</iq>


s res:
<iq type="result" id="NyPcU-43" from="[email protected]" to="[email protected]/Spark 2.6.3">
  <query xmlns="http://jabber.org/protocol/disco#info">
    <identity category="conference" name="聊天室1" type="text"/>
    <feature var="http://jabber.org/protocol/muc"/>
    <feature var="muc_public"/>
    <feature var="muc_open"/>
    <feature var="muc_unmoderated"/>
    <feature var="muc_semianonymous"/>
    <feature var="muc_unsecured"/>
    <feature var="muc_persistent"/>
    <feature var="http://jabber.org/protocol/disco#info"/>
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden">
        <value>http://jabber.org/protocol/muc#roominfo</value>
      </field>
      <field var="muc#roominfo_description" label="描述">
        <value>aaa</value>
      </field>
      <field var="muc#roominfo_subject" label="主题">
        <value>聊天室1_开放的会议室</value>
      </field>
      <field var="muc#roominfo_occupants" label="占有者人数">
        <value>0</value>
      </field>
      <field var="x-muc#roominfo_creationdate" label="创建日期">
        <value>20130101T09:12:33</value>
      </field>
    </x>
  </query>
</iq>


2、进入节目
c req:
<presence id="NyPcU-45" from="[email protected]/Spark 2.6.3" to="[email protected]/9001">
<x xmlns="http://jabber.org/protocol/muc"></x>
</presence>


s res:
<presence id="NyPcU-45" to="[email protected]/Spark 2.6.3" from="[email protected]/9001">
  <x xmlns="http://jabber.org/protocol/muc#user">
    <item affiliation="none" role="participant"/>
  </x>
</presence>
备注:role
case 0: return moderator;//主持
case 1: return participant;//与会者
case 2: return visitor;
case 4: return guest;//嘉宾


s res:
<message type="groupchat" from="[email protected]" to="[email protected]/Spark 2.6.3">
  <subject>聊天室1_开放的会议室</subject>
  <delay xmlns="urn:xmpp:delay" stamp="2013-01-14T08:43:52.571Z" from="[email protected]"/>
  <x xmlns="jabber:x:delay" stamp="20130114T08:43:52" from="[email protected]"/>
</message>


s res:
<message id="NyPcU-38" to="[email protected]/Spark 2.6.3" type="groupchat" from="[email protected]/9001">
  <body>sfsdf</body>
  <x xmlns="jabber:x:event">
    <offline/>
    <delivered/>
    <displayed/>
    <composing/>
  </x>
  <delay xmlns="urn:xmpp:delay" stamp="2013-01-14T08:56:20.171Z" from="[email protected]/9001"/>
  <x xmlns="jabber:x:delay" stamp="20130114T08:56:20" from="[email protected]/9001"/>
</message>


3、节目中群聊发信息
c req:
<message id="NyPcU-46" to="[email protected]" type="groupchat">
<body>test123</body>
<x xmlns="jabber:x:event">
<offline/>
<delivered/>
<displayed/>
<composing/>
</x>
</message>


s res:
<message id="NyPcU-46" to="[email protected]/Spark 2.6.3" type="groupchat" from="[email protected]/9001">
  <body>test123</body>
  <x xmlns="jabber:x:event">
    <offline/>
    <delivered/>
    <displayed/>
    <composing/>
  </x>
</message>


4、退去节目
c req:
<presence id="99QBw-34" to="[email protected]/9001" type="unavailable"></presence>
s res:
<presence id="99QBw-34" to="[email protected]/Spark 2.6.3" from="[email protected]/9001" type="unavailable">
  <x xmlns="http://jabber.org/protocol/muc#user">
    <item affiliation="none" role="none"/>
  </x>
</presence>

猜你喜欢

转载自wanxw2001.iteye.com/blog/1771089