Subscription
Represents a potential subscription to the PubNub real-time network.
Create objects of this class through the com.pubnub.api.v2.entities.Subscribable.subscription method of the respective entities, such as com.pubnub.api.java.v2.entities.Channel, com.pubnub.api.java.v2.entities.ChannelGroup, com.pubnub.api.java.v2.entities.ChannelMetadata and com.pubnub.api.java.v2.entities.UserMetadata.
Created subscriptions are initially inactive, which means you must call subscribe to start receiving events.
This class implements the AutoCloseable interface to help you release resources by calling unsubscribe and removing all listeners on close. Remember to always call close when you no longer need this Subscription.
Functions
Add a listener.
Create a SubscriptionSet containing this Subscription and the added subscription.
Removes all listeners.
Remove a listener.
Sets the handler for incoming channelMetadata events. This method allows the assignment of an OnChannelMetadataHandler implementation or lambda expression to handle incoming presence events.
Sets the handler for incoming file events. This method allows the assignment of an OnFileHandler implementation or lambda expression to handle incoming presence events.
Sets the handler for incoming membership events. This method allows the assignment of an OnMembershipHandler implementation or lambda expression to handle incoming presence events.
Sets the handler for incoming message events. This method allows the assignment of an OnMessageHandler implementation or lambda expression to handle incoming messages.
Sets the handler for incoming messageAction events. This method allows the assignment of an OnMessageActionHandler implementation or lambda expression to handle incoming presence events.
Sets the handler for incoming presence events. This method allows the assignment of an OnPresenceHandler implementation or lambda expression to handle incoming presence events.
Sets the handler for incoming signal events. This method allows the assignment of an OnSignalHandler implementation or lambda expression to handle incoming signals.
Sets the handler for incoming uuidMetadata events. This method allows the assignment of an OnUuidMetadataHandler implementation or lambda expression to handle incoming presence events.
Start receiving events from the subscriptions (or subscriptions) represented by this object.