How to reject subscription

User A subscribes to me. Below is the code I use to reject the subscription.

Presence l_presence = new Presence(Presence.Type.UNSUBSCRIBE);

l_presence.setTo(p_strContact + “@” + HOST);


If user A is login, then I can reject the subscription. However, if the user is not login, above code does not raise any exception, and

the subscription still there.

How do I really reject the subscription even if user A is not login ?

Hey Tan Chen,

To reject a presence subscription you should send a presence of type unsubscribed. For more information you can read the XMPP spec section 6.2.


– Gato