unsubscribe

expect abstract fun unsubscribe(channels: List<String> = emptyList(), channelGroups: List<String> = emptyList())
actual abstract fun unsubscribe(channels: List<String>, channelGroups: List<String>)

When subscribed to a single channel, this function causes the client to issue a leave from the channel and close any open socket to the PubNub Network.

For multiplexed channels, the specified channel(s) will be removed and the socket remains open until there are no more channels remaining in the list.

WARNING Unsubscribing from all the channel(s) and then subscribing to a new channel Y isn't the same as Subscribing to channel Y and then unsubscribing from the previously subscribed channel(s).

Unsubscribing from all the channels resets the timetoken and thus, there could be some gaps in the subscriptions that may lead to a message loss.

Parameters

channels

Channels to subscribe/unsubscribe. Either channel or channelGroups are required.

channelGroups

Channel groups to subscribe/unsubscribe. Either channelGroups or channels are required.

actual abstract fun unsubscribe(channels: List<String>, channelGroups: List<String>)