SubscriptionSet

A helper class that manages multiple Subscriptions that can be added to it.

Use the com.pubnub.api.java.PubNub.subscriptionSetOf factory methods to create instances of this interface.

Adding multiple Subscriptions to the set, then calling subscribe or unsubscribe on the set is more efficient than calling Subscription.subscribe on each Subscription object separately, as the PubNub client can minimize the number of required reconnections internally.

Remember to always close the set when you're done using it to avoid memory leaks. Closing the set also closes all Subscriptions that are part of this set.

Properties

Link copied to clipboard

Returns an immutable copy of the set of subscriptions contained in this SubscriptionSet.

Functions

Link copied to clipboard
abstract fun add(subscription: Subscription)

Add a Subscription to this set.

Link copied to clipboard
abstract fun addListener(listener: EventListener)

Add a listener.

Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract operator fun minusAssign(subscription: Subscription)

Remove the subscription from this set. Equivalent to calling remove.

Link copied to clipboard
abstract operator fun plusAssign(subscription: Subscription)

Add the subscription to this SubscriptionSet. Equivalent to calling add.

Link copied to clipboard
abstract fun remove(subscription: Subscription)

Remove the subscription from this set.

Link copied to clipboard
abstract fun removeAllListeners()

Removes all listeners.

Link copied to clipboard
abstract fun removeListener(listener: Listener)

Remove a listener.

Link copied to clipboard
abstract fun setOnChannelMetadata(onChannelMetadataHandler: OnChannelMetadataHandler?)

Sets the handler for incoming channelMetadata events. This method allows the assignment of an OnChannelMetadataHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnFile(onFileHandler: OnFileHandler?)

Sets the handler for incoming file events. This method allows the assignment of an OnFileHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnMembership(onMembershipHandler: OnMembershipHandler?)

Sets the handler for incoming membership events. This method allows the assignment of an OnMembershipHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnMessage(onMessageHandler: OnMessageHandler?)

Sets the handler for incoming message events. This method allows the assignment of an OnMessageHandler implementation or lambda expression to handle incoming messages.

Link copied to clipboard
abstract fun setOnMessageAction(onMessageActionHandler: OnMessageActionHandler?)

Sets the handler for incoming messageAction events. This method allows the assignment of an OnMessageActionHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnPresence(onPresenceHandler: OnPresenceHandler?)

Sets the handler for incoming presence events. This method allows the assignment of an OnPresenceHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnSignal(onSignalHandler: OnSignalHandler?)

Sets the handler for incoming signal events. This method allows the assignment of an OnSignalHandler implementation or lambda expression to handle incoming signals.

Link copied to clipboard
abstract fun setOnUuidMetadata(onUuidMetadataHandler: OnUuidMetadataHandler?)

Sets the handler for incoming uuidMetadata events. This method allows the assignment of an OnUuidMetadataHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun subscribe()

Start receiving events from the subscriptions (or subscriptions) represented by this object.

abstract fun subscribe(cursor: SubscriptionCursor)
Link copied to clipboard
abstract fun unsubscribe()