PubNub

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val baseUrl: String
Link copied to clipboard

Get 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.

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

Adds a channel to a channel group.

Link copied to clipboard
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.

Link copied to clipboard

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

Link copied to clipboard

Enable push notifications on provided set of channels.

Link copied to clipboard

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

Link copied to clipboard
abstract fun channel(name: String): Channel
Link copied to clipboard
abstract fun channelGroup(name: String): ChannelGroup
Link copied to clipboard
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?): String

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

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

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

Link copied to clipboard

Removes the channel group.

Link copied to clipboard

Delete file from specified Channel.

Link copied to clipboard

Removes messages from the history of a specific channel.

Link copied to clipboard
abstract fun destroy()

Frees up threads eventually and allows for a clean exit.

Link copied to clipboard
abstract fun disconnect()

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

Link copied to clipboard

Download file from specified Channel.

Link copied to clipboard
abstract fun encrypt(inputString: String): String
abstract fun encrypt(inputString: String, cipherKey: String?): String

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

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

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

Link copied to clipboard

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

Link copied to clipboard
abstract fun fire(): Publish
abstract fun fire(message: Any, channel: String): PublishBuilder

Send a message to PubNub Functions Event Handlers.

Link copied to clipboard
abstract fun forceDestroy()

Same as destroy but immediately.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
abstract fun getPresenceState(): GetState

Retrieve state information specific to a subscriber UUID.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

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

Link copied to clipboard
abstract fun grantToken(ttl: Int): GrantTokenBuilder

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

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

Link copied to clipboard
abstract fun history(): History

Fetch historical messages of a channel.

Link copied to clipboard

Lists all registered channel groups for the subscribe key.

Link copied to clipboard

Lists all the channels of the channel group.

Link copied to clipboard

Retrieve list of files uploaded to Channel.

Link copied to clipboard

Set or remove members in a channel.

Link copied to clipboard

Add and/or remove channel memberships for a UUID.

Link copied to clipboard

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.

Link copied to clipboard
abstract fun parseToken(token: String): PNToken
Link copied to clipboard
abstract fun presence(): PresenceBuilder

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.

Link copied to clipboard
abstract fun publish(): Publish
abstract fun publish(message: Any, channel: String): PublishBuilder

Send a message to all subscribers of a channel.

Link copied to clipboard

Publish file message from specified Channel.

Link copied to clipboard
abstract fun reconnect()

abstract fun reconnect(timetoken: Long = 0)

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

Link copied to clipboard
abstract fun removeAllListeners()

Removes all listeners.

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

Link copied to clipboard
abstract fun removeChannelMembers(channelId: String, channelMembers: Collection<String>): RemoveChannelMembersBuilder

Remove members from a Channel.

Link copied to clipboard

Removes the metadata from a specified channel.

Link copied to clipboard

Removes channels from a channel group.

Link copied to clipboard
abstract fun removeListener(listener: Listener)

Remove a listener.

Link copied to clipboard
abstract fun removeMemberships(channelMemberships: Collection<String>): RemoveMembershipsBuilder

Remove channel memberships for a UUID.

Link copied to clipboard

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

Link copied to clipboard

Disable push notifications on provided set of channels.

Link copied to clipboard

Removes the metadata from a specified UUID.

Link copied to clipboard
abstract fun revokeToken(): RevokeToken

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

Link copied to clipboard
abstract fun sendFile(): SendFile.Builder

Upload file / data to specified Channel.

Link copied to clipboard
abstract fun setChannelMembers(channelId: String, channelMembers: Collection<PNUser>): SetChannelMembersBuilder

This method sets members in a channel.

Link copied to clipboard

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

Link copied to clipboard

Set channel memberships for a UUID.

Set channel memberships for a User.

Link copied to clipboard
abstract fun setOnChannelMetadata(onChannelMetadataHandler: OnChannelMetadataHandler?)

Sets the handler for incoming channelMetadata events. This method allows the assignment of an OnChannelMetadataHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnFile(onFileHandler: OnFileHandler?)

Sets the handler for incoming file events. This method allows the assignment of an OnFileHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnMembership(onMembershipHandler: OnMembershipHandler?)

Sets the handler for incoming membership events. This method allows the assignment of an OnMembershipHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnMessage(onMessageHandler: OnMessageHandler?)

Sets the handler for incoming message events. This method allows the assignment of an OnMessageHandler implementation or lambda expression to handle incoming messages.

Link copied to clipboard
abstract fun setOnMessageAction(onMessageActionHandler: OnMessageActionHandler?)

Sets the handler for incoming messageAction events. This method allows the assignment of an OnMessageActionHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnPresence(onPresenceHandler: OnPresenceHandler?)

Sets the handler for incoming presence events. This method allows the assignment of an OnPresenceHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setOnSignal(onSignalHandler: OnSignalHandler?)

Sets the handler for incoming signal events. This method allows the assignment of an OnSignalHandler implementation or lambda expression to handle incoming signals.

Link copied to clipboard
abstract fun setOnUuidMetadata(onUuidMetadataHandler: OnUuidMetadataHandler?)

Sets the handler for incoming uuidMetadata events. This method allows the assignment of an OnUuidMetadataHandler implementation or lambda expression to handle incoming presence events.

Link copied to clipboard
abstract fun setPresenceState(): SetState

Set state information specific to a subscriber UUID.

Link copied to clipboard
abstract fun setToken(token: String?)

Update the authorization token granted by the server.

Link copied to clipboard

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

Link copied to clipboard
abstract fun signal(): Signal
abstract fun signal(message: Any, channel: String): SignalBuilder

Send a signal to all subscribers of a channel.

Link copied to clipboard
abstract fun subscribe(): SubscribeBuilder

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

Link copied to clipboard
abstract fun subscriptionSetOf(subscriptions: Set<Subscription>): SubscriptionSet
Link copied to clipboard
abstract fun time(): Time

Returns a 17 digit precision Unix epoch from the server.

Link copied to clipboard

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.

Link copied to clipboard
abstract fun unsubscribeAll()

Unsubscribe from all channels and all channel groups

Link copied to clipboard
abstract fun userMetadata(id: String): UserMetadata
Link copied to clipboard
abstract fun whereNow(): WhereNow

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