SubscriptionSet

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

Use the com.pubnub.api.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
open var onFile: (PNFileEventResult) -> Unit?

A nullable property to set a function or lambda for responding to file events. This function is invoked whenever a new file event is received, providing a convenient way to process or react to file events.

Link copied to clipboard

A nullable property that can be set to a function (or lambda expression) to handle incoming message events. This function is invoked whenever a new message is received, providing a convenient way to process or react to messages.

Link copied to clipboard

A nullable property that allows setting a function or lambda to react to message action events. This function is invoked whenever a new message action is received, providing a convenient way to process or react to message actions.

Link copied to clipboard

A nullable property for assigning a function or lambda to handle object events. This function is triggered with each new object event, providing a mechanism to manage object-related updates.

Link copied to clipboard

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.

Link copied to clipboard
open var onSignal: (PNSignalResult) -> Unit?

A nullable property for assigning a function or lambda expression to handle incoming signal events. This function is called whenever a new signal is received, providing a convenient way to process or react to signals.

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
expect 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 subscribe(cursor: SubscriptionCursor)
Link copied to clipboard
abstract fun unsubscribe()