我嘗試從pubsub節點取消訂閱時遇到問題。ejabberd pubsub退訂問題
我在寫js的BOSH客戶端。
這是如何訂閱(一個完整的JID):
<body rid='1023502710' xmlns='http://jabber.org/protocol/httpbind' sid='2ded0255fc6e8bf912a2871d415173faadecfea6'>
<presence xmlns='jabber:client'/>
<presence from='[email protected]/my_resource' to='amd.my.server.com/sav' xmlns='jabber:client'/>
<iq to='pubsub.my.server.com' type='set' xmlns='jabber:client' id='5007:sendIQ'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe node='/home/monitoring/sav' jid='[email protected]/my_resource'/>
</pubsub>
</iq>
</body>
在我的下一個綁定請求,收到以下節(因爲我已經有一個節點屬性訂閱):
http://xmpp.org/extensions/xep-0060.html#example-24:實體也可以通過在元素上包含一個「節點」屬性來請求特定節點上的所有訂閱(例如,如果它具有多個SubID的訂閱)。
<body xmlns='http://jabber.org/protocol/httpbind'>
<message xmlns='jabber:client' from='pubsub.my.server.com' to='[email protected]/my_resource'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='/home/monitoring/sav'>
<item id='monitor'>
<!-- some pubsub information -->
</item>
</items>
</event>
<delay xmlns='urn:xmpp:delay' from='amd.my.server.com' stamp='2012-09-14T12:36:28Z'/>
</message>
<iq xmlns='jabber:client' from='pubsub.my.server.com' to='[email protected]/my_resource' id='5007:sendIQ' type='result'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscription jid='[email protected]/my_resource' subscription='subscribed' subid='543990DD8E6E6' node='/home/monitoring/sav'/>
</pubsub>
</iq>
<message xmlns='jabber:client' from='pubsub.my.server.com' to='[email protected]/my_resource' type='headline'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='/home/monitoring/sav'>
<item id='monitor'>
<!-- some pubsub information -->
</item>
</items>
</event>
<headers xmlns='http://jabber.org/protocol/shim'>
<header name='Collection'>/home/monitoring/sav</header>
<header name='SubID'>5435B7F0CA392</header>
<!-- a lot of other SubIDs -->
</headers>
</message>
</body>
在標題部分,我收到了很多SubID。我想這是不好的退訂。
當我結束我的會議,我從各個子ID unsubsribe:
<body rid='1023502724' xmlns='http://jabber.org/protocol/httpbind' sid='2ded0255fc6e8bf912a2871d415173faadecfea6'>
<iq to='pubsub.my.server.com' type='set' xmlns='jabber:client' id='5008:sendIQ'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<unsubscribe node='/home/monitoring/sav' jid='[email protected]' subid='5435B7F0CA392'/>
</pubsub>
</iq>
<!-- a lot of other unsubscribed iqs -->
</body>
答案是眼前:
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' from='pubsub.my.server.com' to='[email protected]/my_resource' type='error' id='5008:sendIQ'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<unsubscribe node='/home/monitoring/sav' jid='[email protected]' subid='5435B7F0CA392'/>
</pubsub>
<error code='401' type='cancel'>
<unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<not-subscribed xmlns='http://jabber.org/protocol/pubsub#errors'/>
</error>
</iq>
</body>
沒有其他子ID是mentionned除了第一我最初收到。
我在做什麼錯?
我正在運行ejabberd 2.1.10。
這就是我用來做的,所以我爲了解決另一個問題而做了它(我不記得它是什麼:我會問我的團隊,但我認爲這是當peaple沒有正確退訂時,因爲任何原因,例如瀏覽器崩潰或殘酷關機)。我會再試一次,但我不知道ejabberd中保存了哪些信息。謝謝 –