Subscribing to offline user

Hi,

Suppose we have a user A who adds another user B to his roster using createEntry() function in Roster. Smack automatically sends a Presence packet with Type subscribe to user B. Assuming user B has his subscription mode set to manual, he has to actively listen for the Presence packets to determine whether or not to reject/accept the subscription request. However, in the case if user B is offline when user A sends the subscription request, user B does not receive the Presence packet when he next goes online.

For Openfire server, is there a way to store the Presence packets when a user is offline and forward them the next time the user is online? If not, what is the recommended way to enable offline subscription?

Any help is appreciated. Thanks.

Hi,

Offline subscription packets are working for me using Spark (which uses Smack internally) and Openfire, so I think you may have a problem with your code somewhere. I would guess that you aren’t adding your presence listener soon enough possibly. An easy way to check whether the packets are being received by Smack is to use the Smack Debugger.

Chris

Thanks, shifting the code for listening to Presence packets to an earlier stage seems to have solved the problem of receiving offline subscription packets.

However, I still cannot receive offline Presence packets of type ‘subscribed’ which I send manually to indicate that the subscription request has been accepted. A check at the server admin console indicates that the subscription has been successfully accepted. Problem is, the subscriber does not receive the confirmation if he was offline at the time the packet was sent.

It may be that it is supposed to work that way, I’m not sure. Your best bet is to see how other clients behave, like Spark for example and that should tell you if it is possible or not. You can also look at this document, which describes the rules for subscriptions the server should be following: http://www.xmpp.org/rfcs/rfc3921.html#substates