onPresence

A nullable property designed to set a function or lambda expression for handling incoming presence events. This function is called whenever a new presence event occurs, offering an efficient method for tracking presence updates.

Note that this property allows for the assignment of a singular behavior at a time, as any new assignment will override the previous one. For scenarios requiring multiple behaviors in response to presence events, it is advisable to utilize EventEmitter.addListener.

To deactivate the current behavior, simply set this property to null.

Setting a Behavior Example:

onPresence = { pnPresenceEventResult ->
println("Presence event: ${pnPresenceEventResult.event}")
}

Removing a Behavior Example:

onPresence = null