subscription

abstract override fun subscription(options: SubscriptionOptions): Subscription

Returns a Subscription that can be used to subscribe to this channel.

Channel subscriptions support passing com.pubnub.api.v2.subscriptions.SubscriptionOptions.receivePresenceEvents in options to enable receiving presence events.

com.pubnub.api.v2.subscriptions.SubscriptionOptions.filter can be used to filter events delivered to the subscription.

For example, to create a subscription that only listens to presence events:

channel.subscription(SubscriptionOptions.receivePresenceEvents() + SubscriptionOptions.filter { it is PNPresenceEventResult } )

Return

an inactive Subscription to this channel. You must call Subscription.subscribe to start receiving events.

Parameters

options

abstract fun subscription(): Subscription

Returns a Subscription that can be used to subscribe to this channel.

The returned Subscription is initially inactive. You must call Subscription.subscribe on it to start receiving events.

Return

An inactive Subscription to this channel.