2014-04-02 73 views
0

我嘗試實現「羣聊」功能XMPP MUC功能沒有實現

這是我的部署環境

 
Openfire (3.9.1) 
Strophe.js (1.1.3) 
strophe.muc.js (1.7.1) 
XAMPP for Windows (1.8.2) 

我發送請求希望得到XMPP命名空間常數

<body rid='641581465' xmlns='http://jabber.org/protocol/httpbind' sid='189f4df8'> 
     <iq xmlns='jabber:client' type='get' from='[email protected]/189f4df8' to='tkb-c0695c83280' id='189f4df8'> 
      <query xmlns='http://jabber.org/protocol/disco#info'/> 
     </iq> 

得到迴應後

<body xmlns="http://jabber.org/protocol/httpbind"> 
<iq id="189f4df8" xmlns="jabber:client" type="result" from="tkb-c0695c83280" to="[email protected]/189f4df8"> 
    <query xmlns="http://jabber.org/protocol/disco#info"> 
     <identity category="server" name="Openfire Server" type="im"></identity> 
     <identity category="pubsub" type="pep"></identity> 
     <feature var="http://jabber.org/protocol/pubsub#manage-subscriptions"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#modify-affiliations"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#retrieve-default"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#collections"></feature> 
     <feature var="jabber:iq:private"></feature> 
     <feature var="http://jabber.org/protocol/disco#items"></feature> 
     <feature var="vcard-temp"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#publish"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#subscribe"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#retract-items"></feature> 
     <feature var="http://jabber.org/protocol/offline"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#meta-data"></feature> 
     <feature var="jabber:iq:register"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#retrieve-subscriptions"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#default_access_model_open"></feature> 
     <feature var="jabber:iq:roster"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#config-node"></feature> 
     <feature var="http://jabber.org/protocol/address"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#publisher-affiliation"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#item-ids"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#instant-nodes"></feature> 
     <feature var="http://jabber.org/protocol/commands"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#multi-subscribe"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#outcast-affiliation"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#get-pending"></feature> 
     <feature var="jabber:iq:privacy"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#subscription-options"></feature> 
     <feature var="jabber:iq:last"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#create-and-configure"></feature> 
     <feature var="urn:xmpp:ping"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#retrieve-items"></feature> 
     <feature var="jabber:iq:time"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#create-nodes"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#persistent-items"></feature> 
     <feature var="jabber:iq:version"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#presence-notifications"></feature> 
     <feature var="http://jabber.org/protocol/pubsub"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#retrieve-affiliations"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#delete-nodes"></feature> 
     <feature var="http://jabber.org/protocol/pubsub#purge-nodes"></feature> 
     <feature var="http://jabber.org/protocol/disco#info"></feature> 
     <feature var="http://jabber.org/protocol/rsm"></feature> 
    </query> 
</iq> 

我沒有看到有關http://jabber.org/protocol/muc命名空間常量:(

不久之後,我嘗試使用strophe.muc.js,它溫控功能createInstantRoom發送請求

<body rid='641581477' xmlns='http://jabber.org/protocol/httpbind' sid='189f4df8'> 
     <iq to='tkb-c0695c83280' type='set' xmlns='jabber:client' id='1:sendIQ'> 
       <query xmlns='http://jabber.org/protocol/muc#owner'><x xmlns='jabber:x:data' type='submit'/></query> 
     </iq> 

,並響應

<body xmlns="http://jabber.org/protocol/httpbind"> 
     <iq id="1:sendIQ" xmlns="jabber:client" type="error" from="tkb-c0695c83280" to="[email protected]/189f4df8"> 
       <query xmlns="http://jabber.org/protocol/muc#owner"> 
          <x xmlns="jabber:x:data" type="submit"></x> 
       </query> 
       <error code="501" type="cancel"> 
          <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></feature-not-implemented> 
       </error> 
     </iq> 

我不知道失去了什麼不對的地方,或者請給我一些反饋

回答

0

嘗試剛剛加盟的房間,而不是瞬間創造並看到會發生什麼。如果它不存在並且服務器設置爲允許它,它應該創建該房間。

conn.muc.join(room, nick, msg_handler_cb, pres_handler_cb, roster_cb, password, history_attrs)