PubNub

expect interface PubNub
actual interface PubNub : StatusEmitter, EventEmitter
@ObjCName(name = "PubNubInterface")
actual interface PubNub

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val baseUrl: String
Link copied to clipboard
expect abstract val configuration: PNConfiguration
actual abstract val configuration: PNConfiguration

The configuration that was used to initialize this PubNub instance. Modifying the values in this configuration is not advised, as it may lead to undefined behavior.

actual abstract val configuration: PNConfiguration
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
abstract val timestamp: Int
Link copied to clipboard
abstract val version: String

The current version of the PubNub SDK.

Functions

Link copied to clipboard
expect abstract fun addChannelsToChannelGroup(channels: List<String>, channelGroup: String): AddChannelChannelGroup
actual abstract fun addChannelsToChannelGroup(channels: List<String>, channelGroup: String): AddChannelChannelGroup

Adds a channel to a channel group.

actual abstract fun addChannelsToChannelGroup(channels: List<String>, channelGroup: String): AddChannelChannelGroup
Link copied to clipboard
expect abstract fun addListener(listener: EventListener)
expect abstract fun addListener(listener: StatusListener)
abstract fun addListener(listener: SubscribeCallback)

Add a legacy listener for both client status and events. Prefer addListener(EventListener) and addListener(StatusListener) if possible.

abstract fun addListener(listener: EventListener)
abstract fun addListener(listener: StatusListener)

Add a listener.

actual abstract fun addListener(listener: EventListener)
actual abstract fun addListener(listener: StatusListener)
Link copied to clipboard
abstract fun addMembers(channel: String, uuids: List<MemberInput>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeUUIDDetails: PNUUIDDetailsLevel? = null): ManageChannelMembers
Link copied to clipboard
abstract fun addMemberships(channels: List<ChannelMembershipInput>, uuid: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeChannelDetails: PNChannelDetailsLevel? = null): ManageMemberships
Link copied to clipboard
expect abstract fun addMessageAction(channel: String, messageAction: PNMessageAction): AddMessageAction
actual abstract fun addMessageAction(channel: String, messageAction: PNMessageAction): AddMessageAction

Add an action on a published message. Returns the added action in the response.

actual abstract fun addMessageAction(channel: String, messageAction: PNMessageAction): AddMessageAction
Link copied to clipboard
expect abstract fun addPushNotificationsOnChannels(pushType: PNPushType, channels: List<String>, deviceId: String, topic: String? = null, environment: PNPushEnvironment = PNPushEnvironment.DEVELOPMENT): AddChannelsToPush
actual abstract fun addPushNotificationsOnChannels(pushType: PNPushType, channels: List<String>, deviceId: String, topic: String?, environment: PNPushEnvironment): AddChannelsToPush

Enable push notifications on provided set of channels.

actual abstract fun addPushNotificationsOnChannels(pushType: PNPushType, channels: List<String>, deviceId: String, topic: String?, environment: PNPushEnvironment): AddChannelsToPush
Link copied to clipboard
expect abstract fun auditPushChannelProvisions(pushType: PNPushType, deviceId: String, topic: String? = null, environment: PNPushEnvironment = PNPushEnvironment.DEVELOPMENT): ListPushProvisions
actual abstract fun auditPushChannelProvisions(pushType: PNPushType, deviceId: String, topic: String?, environment: PNPushEnvironment): ListPushProvisions

Request a list of all channels on which push notifications have been enabled using specified ListPushProvisions.deviceId.

actual abstract fun auditPushChannelProvisions(pushType: PNPushType, deviceId: String, topic: String?, environment: PNPushEnvironment): ListPushProvisions
Link copied to clipboard
expect abstract fun channel(name: String): Channel
actual abstract fun channel(name: String): Channel

Create a handle to a Channel that can be used to obtain a Subscription.

actual abstract fun channel(name: String): Channel
Link copied to clipboard
expect abstract fun channelGroup(name: String): ChannelGroup
actual abstract fun channelGroup(name: String): ChannelGroup

Create a handle to a ChannelGroup that can be used to obtain a Subscription.

actual abstract fun channelGroup(name: String): ChannelGroup
Link copied to clipboard
expect abstract fun channelMetadata(id: String): ChannelMetadata
actual abstract fun channelMetadata(id: String): ChannelMetadata

Create a handle to a ChannelMetadata object that can be used to obtain a Subscription to metadata events.

actual abstract fun channelMetadata(id: String): ChannelMetadata
Link copied to clipboard
abstract fun decrypt(inputString: String): String

Perform Cryptographic decryption of an input string using cipher key provided by PNConfiguration.cipherKey.

abstract fun decrypt(inputString: String, cipherKey: String? = null): String

Perform Cryptographic decryption of an input string using a cipher key.

Link copied to clipboard
abstract fun decryptInputStream(inputStream: InputStream, cipherKey: String? = null): InputStream

Perform Cryptographic decryption of an input stream using provided cipher key.

Link copied to clipboard
expect abstract fun deleteChannelGroup(channelGroup: String): DeleteChannelGroup
actual abstract fun deleteChannelGroup(channelGroup: String): DeleteChannelGroup

Removes the channel group.

actual abstract fun deleteChannelGroup(channelGroup: String): DeleteChannelGroup
Link copied to clipboard
expect abstract fun deleteFile(channel: String, fileName: String, fileId: String): DeleteFile
actual abstract fun deleteFile(channel: String, fileName: String, fileId: String): DeleteFile

Delete file from specified Channel.

actual abstract fun deleteFile(channel: String, fileName: String, fileId: String): DeleteFile
Link copied to clipboard
expect abstract fun deleteMessages(channels: List<String>, start: Long? = null, end: Long? = null): DeleteMessages
actual abstract fun deleteMessages(channels: List<String>, start: Long?, end: Long?): DeleteMessages

Removes messages from the history of a specific channel.

actual abstract fun deleteMessages(channels: List<String>, start: Long?, end: Long?): DeleteMessages
Link copied to clipboard
expect abstract fun destroy()
actual abstract fun destroy()

Frees up threads eventually and allows for a clean exit.

actual abstract fun destroy()
Link copied to clipboard
expect abstract fun disconnect()
actual abstract fun disconnect()

Cancel any subscribe and heartbeat loops or ongoing re-connections.

actual abstract fun disconnect()
Link copied to clipboard
expect abstract fun downloadFile(channel: String, fileName: String, fileId: String, cipherKey: String? = null): DownloadFile
actual abstract fun downloadFile(channel: String, fileName: String, fileId: String, cipherKey: String?): DownloadFile

Download file from specified Channel.

actual abstract fun downloadFile(channel: String, fileName: String, fileId: String, cipherKey: String?): DownloadFile
Link copied to clipboard
abstract fun encrypt(inputString: String, cipherKey: String? = null): String

Perform Cryptographic encryption of an input string and a cipher key.

Link copied to clipboard
abstract fun encryptInputStream(inputStream: InputStream, cipherKey: String? = null): InputStream

Perform Cryptographic encryption of an input stream using provided cipher key.

Link copied to clipboard
expect abstract fun fetchMessages(channels: List<String>, page: PNBoundedPage = PNBoundedPage(), includeUUID: Boolean = true, includeMeta: Boolean = false, includeMessageActions: Boolean = false, includeMessageType: Boolean = true, includeCustomMessageType: Boolean = false): FetchMessages
actual abstract fun fetchMessages(channels: List<String>, page: PNBoundedPage, includeUUID: Boolean, includeMeta: Boolean, includeMessageActions: Boolean, includeMessageType: Boolean, includeCustomMessageType: Boolean): FetchMessages
abstract fun fetchMessages(channels: List<String>, maximumPerChannel: Int = 0, start: Long? = null, end: Long? = null, includeMeta: Boolean = false, includeMessageActions: Boolean = false, includeMessageType: Boolean = true, includeCustomMessageType: Boolean = false): FetchMessages

Fetch historical messages from multiple channels. The includeMessageActions flag also allows you to fetch message actions along with the messages.

actual abstract fun fetchMessages(channels: List<String>, page: PNBoundedPage, includeUUID: Boolean, includeMeta: Boolean, includeMessageActions: Boolean, includeMessageType: Boolean, includeCustomMessageType: Boolean): FetchMessages
Link copied to clipboard
expect abstract fun fire(channel: String, message: Any, meta: Any? = null, usePost: Boolean = false): Publish
actual abstract fun fire(channel: String, message: Any, meta: Any?, usePost: Boolean): Publish
abstract fun fire(channel: String, message: Any, meta: Any?, usePost: Boolean, ttl: Int?): Publish

Send a message to PubNub Functions Event Handlers.

actual abstract fun fire(channel: String, message: Any, meta: Any?, usePost: Boolean): Publish
Link copied to clipboard
abstract fun forceDestroy()

Same as destroy but immediately.

Link copied to clipboard
expect abstract fun getAllChannelMetadata(limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false): GetAllChannelMetadata
actual abstract fun getAllChannelMetadata(limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNKey>>, includeCount: Boolean, includeCustom: Boolean): GetAllChannelMetadata

Returns a paginated list of Channel Metadata objects, optionally including the custom data object for each.

actual abstract fun getAllChannelMetadata(limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNKey>>, includeCount: Boolean, includeCustom: Boolean): GetAllChannelMetadata
Link copied to clipboard
expect abstract fun getAllUUIDMetadata(limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false): GetAllUUIDMetadata
actual abstract fun getAllUUIDMetadata(limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNKey>>, includeCount: Boolean, includeCustom: Boolean): GetAllUUIDMetadata

Returns a paginated list of UUID Metadata objects, optionally including the custom data object for each.

actual abstract fun getAllUUIDMetadata(limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNKey>>, includeCount: Boolean, includeCustom: Boolean): GetAllUUIDMetadata
Link copied to clipboard
expect abstract fun getChannelMembers(channel: String, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), include: MemberInclude = MemberInclude()): GetChannelMembers
expect abstract fun getChannelMembers(channel: String, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeUUIDDetails: PNUUIDDetailsLevel? = null, includeType: Boolean = false): GetChannelMembers
actual abstract fun getChannelMembers(channel: String, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, include: MemberInclude): GetChannelMembers
actual abstract fun getChannelMembers(channel: String, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, includeCount: Boolean, includeCustom: Boolean, includeUUIDDetails: PNUUIDDetailsLevel?, includeType: Boolean): GetChannelMembers

The method returns a list of members in a channel. The list will include user metadata for members that have additional metadata stored in the database.

actual abstract fun getChannelMembers(channel: String, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, include: MemberInclude): GetChannelMembers
actual abstract fun getChannelMembers(channel: String, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, includeCount: Boolean, includeCustom: Boolean, includeUUIDDetails: PNUUIDDetailsLevel?, includeType: Boolean): GetChannelMembers
Link copied to clipboard
expect abstract fun getChannelMetadata(channel: String, includeCustom: Boolean = false): GetChannelMetadata
actual abstract fun getChannelMetadata(channel: String, includeCustom: Boolean): GetChannelMetadata

Returns metadata for the specified Channel, optionally including the custom data object for each.

actual abstract fun getChannelMetadata(channel: String, includeCustom: Boolean): GetChannelMetadata
Link copied to clipboard
expect abstract fun getFileUrl(channel: String, fileName: String, fileId: String): GetFileUrl
actual abstract fun getFileUrl(channel: String, fileName: String, fileId: String): GetFileUrl

Generate URL which can be used to download file from target Channel.

actual abstract fun getFileUrl(channel: String, fileName: String, fileId: String): GetFileUrl
Link copied to clipboard
abstract fun getMembers(channel: String, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeUUIDDetails: PNUUIDDetailsLevel? = null): GetChannelMembers
Link copied to clipboard
expect abstract fun getMemberships(userId: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), include: MembershipInclude = MembershipInclude()): GetMemberships
expect abstract fun getMemberships(uuid: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeChannelDetails: PNChannelDetailsLevel? = null, includeType: Boolean = false): GetMemberships
actual abstract fun getMemberships(userId: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, include: MembershipInclude): GetMemberships
actual abstract fun getMemberships(uuid: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, includeCount: Boolean, includeCustom: Boolean, includeChannelDetails: PNChannelDetailsLevel?, includeType: Boolean): GetMemberships

The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.

actual abstract fun getMemberships(userId: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, include: MembershipInclude): GetMemberships
actual abstract fun getMemberships(uuid: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, includeCount: Boolean, includeCustom: Boolean, includeChannelDetails: PNChannelDetailsLevel?, includeType: Boolean): GetMemberships
Link copied to clipboard
expect abstract fun getMessageActions(channel: String, page: PNBoundedPage = PNBoundedPage()): GetMessageActions
actual abstract fun getMessageActions(channel: String, page: PNBoundedPage): GetMessageActions
abstract fun getMessageActions(channel: String, start: Long? = null, end: Long? = null, limit: Int? = null): GetMessageActions

Get a list of message actions in a channel. Returns a list of actions in the response.

actual abstract fun getMessageActions(channel: String, page: PNBoundedPage): GetMessageActions
Link copied to clipboard
expect abstract fun getPresenceState(channels: List<String> = listOf(), channelGroups: List<String> = listOf(), uuid: String = configuration.userId.value): GetState
actual abstract fun getPresenceState(channels: List<String>, channelGroups: List<String>, uuid: String): GetState

Retrieve state information specific to a subscriber UUID.

actual abstract fun getPresenceState(channels: List<String>, channelGroups: List<String>, uuid: String): GetState
Link copied to clipboard
expect abstract fun getSubscribedChannelGroups(): List<String>
actual abstract fun getSubscribedChannelGroups(): List<String>

Queries the local subscribe loop for channel groups currently in the mix.

actual abstract fun getSubscribedChannelGroups(): List<String>
Link copied to clipboard
expect abstract fun getSubscribedChannels(): List<String>
actual abstract fun getSubscribedChannels(): List<String>

Queries the local subscribe loop for channels currently in the mix.

actual abstract fun getSubscribedChannels(): List<String>
Link copied to clipboard
expect abstract fun getToken(): String?
actual abstract fun getToken(): String?
actual abstract fun getToken(): String?
Link copied to clipboard
expect abstract fun getUUIDMetadata(uuid: String? = null, includeCustom: Boolean = false): GetUUIDMetadata
actual abstract fun getUUIDMetadata(uuid: String?, includeCustom: Boolean): GetUUIDMetadata

Returns metadata for the specified UUID, optionally including the custom data object for each.

actual abstract fun getUUIDMetadata(uuid: String?, includeCustom: Boolean): GetUUIDMetadata
Link copied to clipboard
abstract fun grant(read: Boolean = false, write: Boolean = false, manage: Boolean = false, delete: Boolean = false, ttl: Int = -1, authKeys: List<String> = emptyList(), channels: List<String> = emptyList(), channelGroups: List<String> = emptyList(), uuids: List<String> = emptyList()): Grant

This function establishes access permissions for PubNub Access Manager (PAM) by setting the read or write attribute to true. A grant with read or write set to false (or not included) will revoke any previous grants with read or write set to true.

abstract fun grant(read: Boolean = false, write: Boolean = false, manage: Boolean = false, delete: Boolean = false, get: Boolean = false, update: Boolean = false, join: Boolean = false, ttl: Int = -1, authKeys: List<String> = emptyList(), channels: List<String> = emptyList(), channelGroups: List<String> = emptyList(), uuids: List<String> = emptyList()): Grant

See grant

Link copied to clipboard
expect abstract fun grantToken(ttl: Int, meta: CustomObject? = null, authorizedUUID: String? = null, channels: List<ChannelGrant> = emptyList(), channelGroups: List<ChannelGroupGrant> = emptyList(), uuids: List<UUIDGrant> = emptyList()): GrantToken
abstract fun grantToken(ttl: Int, meta: Any? = null, authorizedUserId: UserId? = null, spacesPermissions: List<SpacePermissions> = emptyList(), usersPermissions: List<UserPermissions> = emptyList()): GrantToken
actual abstract fun grantToken(ttl: Int, meta: Any?, authorizedUUID: String?, channels: List<ChannelGrant>, channelGroups: List<ChannelGroupGrant>, uuids: List<UUIDGrant>): GrantToken

This function generates a grant token for PubNub Access Manager (PAM).

actual abstract fun grantToken(ttl: Int, meta: CustomObject?, authorizedUUID: String?, channels: List<ChannelGrant>, channelGroups: List<ChannelGroupGrant>, uuids: List<UUIDGrant>): GrantToken
Link copied to clipboard
expect abstract fun hereNow(channels: List<String> = emptyList(), channelGroups: List<String> = emptyList(), includeState: Boolean = false, includeUUIDs: Boolean = true, limit: Int = 1000, offset: Int? = null): HereNow
actual abstract fun hereNow(channels: List<String>, channelGroups: List<String>, includeState: Boolean, includeUUIDs: Boolean, limit: Int, offset: Int?): HereNow

Obtain information about the current state of a channel including a list of unique user IDs currently subscribed to the channel and the total occupancy count of the channel.

actual abstract fun hereNow(channels: List<String>, channelGroups: List<String>, includeState: Boolean, includeUUIDs: Boolean, limit: Int, offset: Int?): HereNow
Link copied to clipboard
abstract fun history(channel: String, start: Long? = null, end: Long? = null, count: Int = PNHistoryResult.MAX_COUNT, reverse: Boolean = false, includeTimetoken: Boolean = false, includeMeta: Boolean = false): History

Fetch historical messages of a channel.

Link copied to clipboard

Lists all registered channel groups for the subscribe key.

Link copied to clipboard
expect abstract fun listChannelsForChannelGroup(channelGroup: String): AllChannelsChannelGroup
actual abstract fun listChannelsForChannelGroup(channelGroup: String): AllChannelsChannelGroup

Lists all the channels of the channel group.

actual abstract fun listChannelsForChannelGroup(channelGroup: String): AllChannelsChannelGroup
Link copied to clipboard
expect abstract fun listFiles(channel: String, limit: Int? = null, next: PNPage.PNNext? = null): ListFiles
actual abstract fun listFiles(channel: String, limit: Int?, next: PNPage.PNNext?): ListFiles

Retrieve list of files uploaded to Channel.

actual abstract fun listFiles(channel: String, limit: Int?, next: PNPage.PNNext?): ListFiles
Link copied to clipboard
abstract fun manageChannelMembers(channel: String, usersToSet: Collection<MemberInput>, userIdsToRemove: Collection<String>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), include: MemberInclude = MemberInclude()): ManageChannelMembers
abstract fun manageChannelMembers(channel: String, uuidsToSet: Collection<MemberInput>, uuidsToRemove: Collection<String>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeUUIDDetails: PNUUIDDetailsLevel? = null, includeUUIDType: Boolean = false): ManageChannelMembers

Set or remove members in a channel.

Link copied to clipboard
abstract fun manageMemberships(channelsToSet: List<ChannelMembershipInput>, channelsToRemove: List<String>, userId: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), include: MembershipInclude = MembershipInclude()): ManageMemberships
abstract fun manageMemberships(channelsToSet: List<ChannelMembershipInput>, channelsToRemove: List<String>, uuid: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeChannelDetails: PNChannelDetailsLevel? = null, includeType: Boolean = false): ManageMemberships

Add and remove channel memberships for a UUID.

Link copied to clipboard
expect abstract fun messageCounts(channels: List<String>, channelsTimetoken: List<Long>): MessageCounts
actual abstract fun messageCounts(channels: List<String>, channelsTimetoken: List<Long>): MessageCounts

Fetches the number of messages published on one or more channels since a given time. The count returned is the number of messages in history with a timetoken value greater than the passed value in the MessageCounts.channelsTimetoken parameter.

actual abstract fun messageCounts(channels: List<String>, channelsTimetoken: List<Long>): MessageCounts
Link copied to clipboard
expect abstract fun parseToken(token: String): PNToken
actual abstract fun parseToken(token: String): PNToken
actual abstract fun parseToken(token: String): PNToken
Link copied to clipboard
expect abstract fun presence(channels: List<String> = emptyList(), channelGroups: List<String> = emptyList(), connected: Boolean = false)
actual abstract fun presence(channels: List<String>, channelGroups: List<String>, connected: Boolean)

Track the online and offline status of users and devices in real time and store custom state information. When you have Presence enabled, PubNub automatically creates a presence channel for each channel.

actual abstract fun presence(channels: List<String>, channelGroups: List<String>, connected: Boolean)
Link copied to clipboard
expect abstract fun publish(channel: String, message: Any, meta: Any? = null, shouldStore: Boolean? = null, usePost: Boolean = false, replicate: Boolean = true, ttl: Int? = null, customMessageType: String? = null): Publish
actual abstract fun publish(channel: String, message: Any, meta: Any?, shouldStore: Boolean?, usePost: Boolean, replicate: Boolean, ttl: Int?, customMessageType: String?): Publish

Send a message to all subscribers of a channel.

actual abstract fun publish(channel: String, message: Any, meta: Any?, shouldStore: Boolean?, usePost: Boolean, replicate: Boolean, ttl: Int?, customMessageType: String?): Publish
Link copied to clipboard
expect abstract fun publishFileMessage(channel: String, fileName: String, fileId: String, message: Any? = null, meta: Any? = null, ttl: Int? = null, shouldStore: Boolean? = null, customMessageType: String? = null): PublishFileMessage
actual abstract fun publishFileMessage(channel: String, fileName: String, fileId: String, message: Any?, meta: Any?, ttl: Int?, shouldStore: Boolean?, customMessageType: String?): PublishFileMessage

Publish file message from specified Channel.

actual abstract fun publishFileMessage(channel: String, fileName: String, fileId: String, message: Any?, meta: Any?, ttl: Int?, shouldStore: Boolean?, customMessageType: String?): PublishFileMessage
Link copied to clipboard
expect abstract fun reconnect(timetoken: Long = 0)
actual abstract fun reconnect(timetoken: Long)

Force the SDK to try and reach out PubNub. Monitor the results in SubscribeCallback.status

actual abstract fun reconnect(timetoken: Long)
Link copied to clipboard
expect abstract fun removeAllListeners()
abstract fun removeAllListeners()

Removes all listeners.

actual abstract fun removeAllListeners()
expect abstract fun removeAllPushNotificationsFromDeviceWithPushToken(pushType: PNPushType, deviceId: String, topic: String? = null, environment: PNPushEnvironment = PNPushEnvironment.DEVELOPMENT): RemoveAllPushChannelsForDevice

Disable push notifications from all channels registered with the specified RemoveAllPushChannelsForDevice.deviceId.

Link copied to clipboard
expect abstract fun removeChannelMembers(channel: String, userIds: List<String>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), include: MemberInclude = MemberInclude()): ManageChannelMembers
expect abstract fun removeChannelMembers(channel: String, uuids: List<String>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeUUIDDetails: PNUUIDDetailsLevel? = null, includeType: Boolean = false): ManageChannelMembers
actual abstract fun removeChannelMembers(channel: String, userIds: List<String>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, include: MemberInclude): ManageChannelMembers
actual abstract fun removeChannelMembers(channel: String, uuids: List<String>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, includeCount: Boolean, includeCustom: Boolean, includeUUIDDetails: PNUUIDDetailsLevel?, includeType: Boolean): ManageChannelMembers

Remove members from a Channel.

actual abstract fun removeChannelMembers(channel: String, userIds: List<String>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, include: MemberInclude): ManageChannelMembers
actual abstract fun removeChannelMembers(channel: String, uuids: List<String>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, includeCount: Boolean, includeCustom: Boolean, includeUUIDDetails: PNUUIDDetailsLevel?, includeType: Boolean): ManageChannelMembers
Link copied to clipboard
expect abstract fun removeChannelMetadata(channel: String): RemoveChannelMetadata
actual abstract fun removeChannelMetadata(channel: String): RemoveChannelMetadata

Removes the metadata from a specified channel.

actual abstract fun removeChannelMetadata(channel: String): RemoveChannelMetadata
Link copied to clipboard
expect abstract fun removeChannelsFromChannelGroup(channels: List<String>, channelGroup: String): RemoveChannelChannelGroup
actual abstract fun removeChannelsFromChannelGroup(channels: List<String>, channelGroup: String): RemoveChannelChannelGroup

Removes channels from a channel group.

actual abstract fun removeChannelsFromChannelGroup(channels: List<String>, channelGroup: String): RemoveChannelChannelGroup
Link copied to clipboard
expect abstract fun removeListener(listener: Listener)
abstract fun removeListener(listener: Listener)

Remove a listener.

actual abstract fun removeListener(listener: Listener)
Link copied to clipboard
abstract fun removeMembers(channel: String, uuids: List<String>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeUUIDDetails: PNUUIDDetailsLevel? = null): ManageChannelMembers
Link copied to clipboard
expect abstract fun removeMemberships(channels: List<String>, userId: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), include: MembershipInclude = MembershipInclude()): ManageMemberships
expect abstract fun removeMemberships(channels: List<String>, uuid: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeChannelDetails: PNChannelDetailsLevel? = null, includeType: Boolean = false): ManageMemberships
actual abstract fun removeMemberships(channels: List<String>, userId: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, include: MembershipInclude): ManageMemberships
actual abstract fun removeMemberships(channels: List<String>, uuid: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, includeCount: Boolean, includeCustom: Boolean, includeChannelDetails: PNChannelDetailsLevel?, includeType: Boolean): ManageMemberships

Remove channel memberships for a UUID.

actual abstract fun removeMemberships(channels: List<String>, userId: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, include: MembershipInclude): ManageMemberships
actual abstract fun removeMemberships(channels: List<String>, uuid: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, includeCount: Boolean, includeCustom: Boolean, includeChannelDetails: PNChannelDetailsLevel?, includeType: Boolean): ManageMemberships
Link copied to clipboard
expect abstract fun removeMessageAction(channel: String, messageTimetoken: Long, actionTimetoken: Long): RemoveMessageAction
actual abstract fun removeMessageAction(channel: String, messageTimetoken: Long, actionTimetoken: Long): RemoveMessageAction

Remove a previously added action on a published message. Returns an empty response.

actual abstract fun removeMessageAction(channel: String, messageTimetoken: Long, actionTimetoken: Long): RemoveMessageAction
Link copied to clipboard
expect abstract fun removePushNotificationsFromChannels(pushType: PNPushType, channels: List<String>, deviceId: String, topic: String? = null, environment: PNPushEnvironment = PNPushEnvironment.DEVELOPMENT): RemoveChannelsFromPush
actual abstract fun removePushNotificationsFromChannels(pushType: PNPushType, channels: List<String>, deviceId: String, topic: String?, environment: PNPushEnvironment): RemoveChannelsFromPush

Disable push notifications on provided set of channels.

actual abstract fun removePushNotificationsFromChannels(pushType: PNPushType, channels: List<String>, deviceId: String, topic: String?, environment: PNPushEnvironment): RemoveChannelsFromPush
Link copied to clipboard
expect abstract fun removeUUIDMetadata(uuid: String? = null): RemoveUUIDMetadata
actual abstract fun removeUUIDMetadata(uuid: String?): RemoveUUIDMetadata

Removes the metadata from a specified UUID.

actual abstract fun removeUUIDMetadata(uuid: String?): RemoveUUIDMetadata
Link copied to clipboard
expect abstract fun revokeToken(token: String): RevokeToken
actual abstract fun revokeToken(token: String): RevokeToken

This method allows you to disable an existing token and revoke all permissions embedded within.

actual abstract fun revokeToken(token: String): RevokeToken
Link copied to clipboard
expect abstract fun sendFile(channel: String, fileName: String, inputStream: Uploadable, message: Any? = null, meta: Any? = null, ttl: Int? = null, shouldStore: Boolean? = null, cipherKey: String? = null, customMessageType: String? = null): SendFile
actual abstract fun sendFile(channel: String, fileName: String, inputStream: InputStream, message: Any?, meta: Any?, ttl: Int?, shouldStore: Boolean?, cipherKey: String?, customMessageType: String?): SendFile

Upload file / data to specified Channel.

actual abstract fun sendFile(channel: String, fileName: String, inputStream: Uploadable, message: Any?, meta: Any?, ttl: Int?, shouldStore: Boolean?, cipherKey: String?, customMessageType: String?): SendFile
Link copied to clipboard
expect abstract fun setChannelMembers(channel: String, users: List<MemberInput>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), include: MemberInclude = MemberInclude()): ManageChannelMembers
expect abstract fun setChannelMembers(channel: String, uuids: List<MemberInput>, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMemberKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeUUIDDetails: PNUUIDDetailsLevel? = null, includeType: Boolean = false): ManageChannelMembers
actual abstract fun setChannelMembers(channel: String, users: List<MemberInput>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, include: MemberInclude): ManageChannelMembers
actual abstract fun setChannelMembers(channel: String, uuids: List<MemberInput>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, includeCount: Boolean, includeCustom: Boolean, includeUUIDDetails: PNUUIDDetailsLevel?, includeType: Boolean): ManageChannelMembers

This method sets members in a channel.

actual abstract fun setChannelMembers(channel: String, users: List<MemberInput>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, include: MemberInclude): ManageChannelMembers
actual abstract fun setChannelMembers(channel: String, uuids: List<MemberInput>, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMemberKey>>, includeCount: Boolean, includeCustom: Boolean, includeUUIDDetails: PNUUIDDetailsLevel?, includeType: Boolean): ManageChannelMembers
Link copied to clipboard
expect abstract fun setChannelMetadata(channel: String, name: String? = null, description: String? = null, custom: CustomObject? = null, includeCustom: Boolean = false, type: String? = null, status: String? = null, ifMatchesEtag: String? = null): SetChannelMetadata
actual abstract fun setChannelMetadata(channel: String, name: String?, description: String?, custom: CustomObject?, includeCustom: Boolean, type: String?, status: String?, ifMatchesEtag: String?): SetChannelMetadata

Set metadata for a Channel in the database, optionally including the custom data object for each.

actual abstract fun setChannelMetadata(channel: String, name: String?, description: String?, custom: CustomObject?, includeCustom: Boolean, type: String?, status: String?, ifMatchesEtag: String?): SetChannelMetadata
Link copied to clipboard
expect abstract fun setMemberships(channels: List<ChannelMembershipInput>, userId: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), include: MembershipInclude = MembershipInclude()): ManageMemberships
expect abstract fun setMemberships(channels: List<ChannelMembershipInput>, uuid: String? = null, limit: Int? = null, page: PNPage? = null, filter: String? = null, sort: Collection<PNSortKey<PNMembershipKey>> = listOf(), includeCount: Boolean = false, includeCustom: Boolean = false, includeChannelDetails: PNChannelDetailsLevel? = null, includeType: Boolean = false): ManageMemberships
actual abstract fun setMemberships(channels: List<ChannelMembershipInput>, userId: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, include: MembershipInclude): ManageMemberships
actual abstract fun setMemberships(channels: List<ChannelMembershipInput>, uuid: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, includeCount: Boolean, includeCustom: Boolean, includeChannelDetails: PNChannelDetailsLevel?, includeType: Boolean): ManageMemberships

Set channel memberships for a UUID.

actual abstract fun setMemberships(channels: List<ChannelMembershipInput>, userId: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, include: MembershipInclude): ManageMemberships
actual abstract fun setMemberships(channels: List<ChannelMembershipInput>, uuid: String?, limit: Int?, page: PNPage?, filter: String?, sort: Collection<PNSortKey<PNMembershipKey>>, includeCount: Boolean, includeCustom: Boolean, includeChannelDetails: PNChannelDetailsLevel?, includeType: Boolean): ManageMemberships
Link copied to clipboard
expect abstract fun setPresenceState(channels: List<String> = listOf(), channelGroups: List<String> = listOf(), state: Any): SetState
actual abstract fun setPresenceState(channels: List<String>, channelGroups: List<String>, state: Any): SetState
abstract fun setPresenceState(channels: List<String> = listOf(), channelGroups: List<String> = listOf(), state: Any, uuid: String = configuration.userId.value): SetState

Set state information specific to a subscriber UUID.

actual abstract fun setPresenceState(channels: List<String>, channelGroups: List<String>, state: Any): SetState
Link copied to clipboard
expect abstract fun setToken(token: String?)
actual abstract fun setToken(token: String?)
actual abstract fun setToken(token: String?)
Link copied to clipboard
expect abstract fun setUUIDMetadata(uuid: String? = null, name: String? = null, externalId: String? = null, profileUrl: String? = null, email: String? = null, custom: CustomObject? = null, includeCustom: Boolean = false, type: String? = null, status: String? = null, ifMatchesEtag: String? = null): SetUUIDMetadata
actual abstract fun setUUIDMetadata(uuid: String?, name: String?, externalId: String?, profileUrl: String?, email: String?, custom: Any?, includeCustom: Boolean, type: String?, status: String?, ifMatchesEtag: String?): SetUUIDMetadata

Set metadata for a UUID in the database, optionally including the custom data object for each.

actual abstract fun setUUIDMetadata(uuid: String?, name: String?, externalId: String?, profileUrl: String?, email: String?, custom: CustomObject?, includeCustom: Boolean, type: String?, status: String?, ifMatchesEtag: String?): SetUUIDMetadata
Link copied to clipboard
expect abstract fun signal(channel: String, message: Any, customMessageType: String? = null): Signal
actual abstract fun signal(channel: String, message: Any, customMessageType: String?): Signal

Send a signal to all subscribers of a channel.

actual abstract fun signal(channel: String, message: Any, customMessageType: String?): Signal
Link copied to clipboard
expect abstract fun subscribe(channels: List<String> = emptyList(), channelGroups: List<String> = emptyList(), withPresence: Boolean = false, withTimetoken: Long = 0)
actual abstract fun subscribe(channels: List<String>, channelGroups: List<String>, withPresence: Boolean, withTimetoken: Long)

Causes the client to create an open TCP socket to the PubNub Real-Time Network and begin listening for messages on a specified channel.

actual abstract fun subscribe(channels: List<String>, channelGroups: List<String>, withPresence: Boolean, withTimetoken: Long)
Link copied to clipboard
expect abstract fun subscriptionSetOf(subscriptions: Set<Subscription>): SubscriptionSet
expect abstract fun subscriptionSetOf(channels: Set<String> = emptySet(), channelGroups: Set<String> = emptySet(), options: SubscriptionOptions = EmptyOptions): SubscriptionSet
actual abstract fun subscriptionSetOf(subscriptions: Set<Subscription>): SubscriptionSet

Create a SubscriptionSet from the given subscriptions.

actual abstract fun subscriptionSetOf(channels: Set<String>, channelGroups: Set<String>, options: SubscriptionOptions): SubscriptionSet

Create a SubscriptionSet containing Subscription objects for the given sets of channels and channelGroups.

actual abstract fun subscriptionSetOf(subscriptions: Set<Subscription>): SubscriptionSet
actual abstract fun subscriptionSetOf(channels: Set<String>, channelGroups: Set<String>, options: SubscriptionOptions): SubscriptionSet
Link copied to clipboard
expect abstract fun time(): Time
actual abstract fun time(): Time

Returns a 17 digit precision Unix epoch from the server.

actual abstract fun time(): Time
Link copied to clipboard
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.

actual abstract fun unsubscribe(channels: List<String>, channelGroups: List<String>)
Link copied to clipboard
expect abstract fun unsubscribeAll()
actual abstract fun unsubscribeAll()

Unsubscribe from all channels and all channel groups.

actual abstract fun unsubscribeAll()
Link copied to clipboard
expect abstract fun userMetadata(id: String): UserMetadata
actual abstract fun userMetadata(id: String): UserMetadata

Create a handle to a UserMetadata object that can be used to obtain a Subscription to user metadata events.

actual abstract fun userMetadata(id: String): UserMetadata
Link copied to clipboard
expect abstract fun whereNow(uuid: String = configuration.userId.value): WhereNow
actual abstract fun whereNow(uuid: String): WhereNow

Obtain information about the current list of channels to which a UUID is subscribed to.

actual abstract fun whereNow(uuid: String): WhereNow