powered by Jive Software

RosterListener vs PresenceEventListener


#1

Hello, I’m wondering what is the difference between RosterListener and PresenceEventListener interface. I know they have different methods such as PresenceEventListener. presenceSubscribed which isn’t available in RosterListener.

However, there are similar methods such as RosterListener.presenceChanged and PresenceEventListener.presenceAvailable.
And there is no documentation at all for PresenceEventListener. I’m listening for presence changes but it just worked using roster.addRosterListener instead of roster.addPresenceEventListener.

I’m using smack 4.3.1.


#2

RosterListener is invoked if something in your roster changes, this includes new presences from entitites in your roster.

PresenceListener is invoked every time a new presence arrives, this includes also presences from entities not in your roster.


#3

Thanks for clarifying.
I suppose that using PresenceListener I need to send a subscription request for the entity to be allowed to receive presence notifications.


#4

Not strictly, the remote entity could also send you a directed presence, but usually yes.