Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
ChrisTutt #1
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Subject: Unsubscribe doesn't seem to work
Hello,

When I unsubscribe from a user that is currently offline, it seems the request is ignored.  You can see below that ChrisTest3@voice2000.eu.bc.im and I are subscribed to each other, but then use

  1. using (PresenceManager pm = new PresenceManager(Client))
  2. pm.Unsubscribe(jId);

to unsubscribe.  This is what the logs show

  1. SERVER >> CLIENT (24/03/2015@09:47:09)
  2. <iq id="MX_3" to="442082881248@voice2000.eu.bc.im/MatriX" xmlns="jabber:client" type="result">
  3.  <query xmlns="jabber:iq:roster">
  4.     <item name="christest3" jid="christest3@voice2000.eu.bc.im" subscription="both" />
  5.  </query>
  6. </iq>
  7.  
  8. CLIENT >> SERVER (24/03/2015@09:47:15)
  9. <presence xmlns="jabber:client">
  10.  <show>chat</show>
  11.  <status>Available for chat</status>
  12.  <priority>0</priority>
  13. </presence>
  14.  
  15. SERVER >> CLIENT (24/03/2015@09:47:15)
  16. <presence from="442082881248@voice2000.eu.bc.im/MatriX" to="442082881248@voice2000.eu.bc.im" xmlns="jabber:client">
  17.  <show>chat</show>
  18.  <status>Available for chat</status>
  19.  <priority>0</priority>
  20. </presence>
  21.  
  22. CLIENT >> SERVER (24/03/2015@09:47:26)
  23. <presence type="unsubscribe" to="ChrisTest3@voice2000.eu.bc.im" xmlns="jabber:client" />
After that there's nothing received.  I would expect to see a roster update showing the subscription="from" or something similar, but there's nothing.  Then when I restart my application I get the same subscription="both"  in the roster.  Why would this be?  Surely the user doesn't need to allow me to unsubscribe to their presence, like when I want to subscribe?

Even if there is no roster update after I unsubscribe, when I restart my app I would expect to see the subscription change to "from".  Currently it's like my unsubscribe request is completely ignored...

Any help would be appreciated.

Thanks,
Chris
This post was edited on 2015-03-24, 11:23 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The Jid in your log includes upper case characters.

<presence type="unsubscribe" to="ChrisTest3@voice2000.eu.bc.im" xmlns="jabber:client" />

Can you try to lower it (normalize), before you unsubscribe?
The casing could cause the problem.

Alex
Avatar
ChrisTutt #3
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex, I changed the JID to lower case but that hasn't made a difference, I send the Unsubscribe message and no response is received, and when I restart my application the subscription is still "both"

<presence type="unsubscribe" to="christest3@voice2000.eu.bc.im" xmlns="jabber:client" />

I don't want to remove the user from my roster as that will stop the subscription both ways right?

What should I be getting back from the server when I unsubscribe?  Would it be a presence event with "unsubscribe" or "unsubscribed"?

Chris
Avatar
ChrisTutt #4
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Alex do you know if there is a logging option with Psi?  If so I could login using that client and see if anything is happening differently...

Thanks,
Chris
Avatar
Alex #5
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by ChrisTutt:
Alex do you know if there is a logging option with Psi?
yes, you have to add the "Xml Console" button to the toolbar, then you can show the Xml Console and activate logging.
Avatar
Alex #6
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #3
Quote by ChrisTutt:
I don't want to remove the user from my roster as that will stop the subscription both ways right?
an unsubscribe with stop both as well. The unsubscribe tells the server that you are not interested at the users presence anymore.


Quote by ChrisTutt:
What should I be getting back from the server when I unsubscribe?  Would it be a presence event with "unsubscribe" or "unsubscribed"?

the flow should look like this:

  1. <!-- unsubscribe from user@server.org -->
  2. <presence id='ul4bs71n' to='user@server.org' type='unsubscribe'/>
  3.  
  4. <!-- server sends me a roster update, switch from both to from -->
  5. <iq type="set" id="lx1">
  6.    <query xmlns="jabber:iq:roster" ver="76">
  7.       <item subscription="from" name="Alex" jid="user@server.org"/>
  8.    </query>
  9. </iq>
  10.  
  11. <!-- I should conform this query with a result -->
  12. <iq type="result" id="lx1"/>
  13.  
  14. <!-- server sends me a offline presence for this user, because I unsubscribed from seeing the presense. From mow I should not receive any more presences for this user -->
  15. <presence from="user2@server.org/MiniClient" type="unavailable" to="user@server.org"/>
Avatar
ChrisTutt #7
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
It's not that my presence message shows type as the first attribute is it?  My client sends

  1. <presence type="unsubscribe" to="christest3@voice2000.eu.bc.im" xmlns="jabber:client" />

but your example shows

  1. <presence id='ul4bs71n' to='user@server.org' type='unsubscribe'/>

Also my client is not sending an id attribute but your example is.

I will use Psi to see if I can see anything, but maybe without the id attribute the request is being ignored by the server...  Should I be setting that somewhere in my code?

Thanks,
Chris
This post was edited on 2015-03-24, 13:04 by Alex.
Avatar
Alex #8
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I sent it with the Psi Raw console.
The id is optional and not required. Presence normally has never an Id.

xmlns="jabber:client is also not required of course, because this is the default namespace.

Is subscription both in the roster for the user you try to unsubscribe?

Alex
Avatar
ChrisTutt #9
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Yes it is, it stays as subscription=both all the time.  This is what I'm getting from the server:

  1. <iq id="MX_3" to="442082881248@voice2000.eu.bc.im/MatriX" xmlns="jabber:client" type="result">
  2.  <query xmlns="jabber:iq:roster">
  3.     <item name="christest3" jid="christest3@voice2000.eu.bc.im" subscription="both" />
  4.  </query>
  5. </iq>
This post was edited on 2015-03-24, 13:11 by Alex.
Avatar
Alex #10
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #8
to clarify on the namespace. When you dump a stanza from the MatriX log then the namespace is added, because the tag it out of the context from the complete Xml stream. So a namespace aware Xml parser adds it automatically.
When the packet gets transmitted in the context of a Xml stream MatriX does not send it on the socket.
Avatar
Alex #11
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  • when are you sending the unsubscribe? After you session is fully established? Not before OnRosterEnd and your own presence went out?
  • Does it work when the user is Online? Because you are saying it does not work when user christest3@voice2000.eu.bc.im is offline
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS