I have issues when I try to unsubscribe from a pubsub node.
I am writting a BOSH client in js.
This is how I subscribe (with a full 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>
On my next bind request, I receive the following stanza (because I've subscribe with a node attribute) :
http://xmpp.org/extensions/xep-0060.html#example-24 : An entity MAY also request all of its subscriptions at a specific node (e.g., if it has subscriptions with multiple SubIDs) by including a 'node' attribute on the element.
<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>
In the headers section, I receive a lot of SubID. I suppose the reason for this is bad unsubscribe.
When I end my session, I unsubsribe from every SubID :
<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>
The answer is immediate :
<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>
No other SubID is mentionned except the first I initially received.
What am I doing wrong ?
I am running ejabberd 2.1.10.