commonMain.com.pubnub.api.v2.subscriptions.Subscription.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-kotlin-api-jvm Show documentation
Show all versions of pubnub-kotlin-api-jvm Show documentation
PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!
The newest version!
package com.pubnub.api.v2.subscriptions
import com.pubnub.api.v2.callbacks.EventEmitter
/**
* 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.v2.entities.Channel], [com.pubnub.api.v2.entities.ChannelGroup],
* [com.pubnub.api.v2.entities.ChannelMetadata] and [com.pubnub.api.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.
*/
interface Subscription : EventEmitter, SubscribeCapable, AutoCloseable {
/**
* Create a [SubscriptionSet] containing this [Subscription] and the added [subscription].
*/
operator fun plus(subscription: Subscription): SubscriptionSet
}