Class PubNub


  • public class PubNub
    extends java.lang.Object
    • Constructor Detail

      • PubNub

        public PubNub​(@NotNull
                      @NotNull PNConfiguration initialConfig)
    • Method Detail

      • getCryptoModule

        public com.pubnub.api.crypto.CryptoModule getCryptoModule()
      • generateUUID

        @NotNull
        public static @NotNull java.lang.String generateUUID()
        Deprecated.
      • getBaseUrl

        @NotNull
        public @NotNull java.lang.String getBaseUrl()
      • addListener

        public void addListener​(@NotNull
                                @NotNull SubscribeCallback listener)
      • removeListener

        public void removeListener​(@NotNull
                                   @NotNull SubscribeCallback listener)
      • addPushNotificationsOnChannels

        @NotNull
        public @NotNull AddChannelsToPush addPushNotificationsOnChannels()
      • removePushNotificationsFromChannels

        @NotNull
        public @NotNull RemoveChannelsFromPush removePushNotificationsFromChannels()
      • removeAllPushNotificationsFromDeviceWithPushToken

        @NotNull
        public @NotNull RemoveAllPushChannelsForDevice removeAllPushNotificationsFromDeviceWithPushToken()
      • auditPushChannelProvisions

        @NotNull
        public @NotNull ListPushProvisions auditPushChannelProvisions()
      • whereNow

        @NotNull
        public @NotNull WhereNow whereNow()
      • hereNow

        @NotNull
        public @NotNull HereNow hereNow()
      • time

        @NotNull
        public @NotNull Time time()
      • history

        @NotNull
        public @NotNull History history()
      • fetchMessages

        @NotNull
        public @NotNull FetchMessages fetchMessages()
      • deleteMessages

        @NotNull
        public @NotNull DeleteMessages deleteMessages()
      • messageCounts

        @NotNull
        public @NotNull MessageCounts messageCounts()
      • grant

        @NotNull
        public @NotNull Grant grant()
      • grantToken

        @NotNull
        public @NotNull GrantTokenBuilder grantToken​(java.lang.Integer ttl)
      • revokeToken

        @NotNull
        public @NotNull RevokeToken revokeToken()
      • getPresenceState

        @NotNull
        public @NotNull GetState getPresenceState()
      • setPresenceState

        @NotNull
        public @NotNull SetState setPresenceState()
      • publish

        @NotNull
        public @NotNull Publish publish()
      • signal

        @NotNull
        public @NotNull Signal signal()
      • getUUIDMetadata

        @NotNull
        public @NotNull GetUUIDMetadata getUUIDMetadata()
      • getMemberships

        @NotNull
        public @NotNull GetMemberships getMemberships()
      • addMessageAction

        @NotNull
        public @NotNull AddMessageAction addMessageAction()
      • decrypt

        @Nullable
        public @Nullable java.lang.String decrypt​(java.lang.String inputString)
                                           throws PubNubException
        Perform Cryptographic decryption of an input string using cipher key provided by PNConfiguration
        Parameters:
        inputString - String to be encrypted
        Returns:
        String containing the encryption of inputString using cipherKey
        Throws:
        PubNubException
      • decrypt

        @Nullable
        public @Nullable java.lang.String decrypt​(java.lang.String inputString,
                                                  java.lang.String cipherKey)
                                           throws PubNubException
        Perform Cryptographic decryption of an input string using the cipher key
        Parameters:
        inputString - String to be encrypted
        cipherKey - cipher key to be used for encryption
        Returns:
        String containing the encryption of inputString using cipherKey
        Throws:
        PubNubException - throws exception in case of failed encryption
      • decryptInputStream

        public java.io.InputStream decryptInputStream​(java.io.InputStream inputStream)
                                               throws PubNubException
        Throws:
        PubNubException
      • decryptInputStream

        public java.io.InputStream decryptInputStream​(java.io.InputStream inputStream,
                                                      java.lang.String cipherKey)
                                               throws PubNubException
        Throws:
        PubNubException
      • encrypt

        @Nullable
        public @Nullable java.lang.String encrypt​(java.lang.String inputString)
                                           throws PubNubException
        Perform Cryptographic encryption of an input string and the cipher key provided by PNConfiguration
        Parameters:
        inputString - String to be encrypted
        Returns:
        String containing the encryption of inputString using cipherKey
        Throws:
        PubNubException
      • encrypt

        @Nullable
        public @Nullable java.lang.String encrypt​(java.lang.String inputString,
                                                  java.lang.String cipherKey)
                                           throws PubNubException
        Perform Cryptographic encryption of an input string and the cipher key.
        Parameters:
        inputString - String to be encrypted
        cipherKey - cipher key to be used for encryption
        Returns:
        String containing the encryption of inputString using cipherKey
        Throws:
        PubNubException - throws exception in case of failed encryption
      • encryptInputStream

        public java.io.InputStream encryptInputStream​(java.io.InputStream inputStream)
                                               throws PubNubException
        Throws:
        PubNubException
      • encryptInputStream

        public java.io.InputStream encryptInputStream​(java.io.InputStream inputStream,
                                                      java.lang.String cipherKey)
                                               throws PubNubException
        Throws:
        PubNubException
      • getTimestamp

        public int getTimestamp()
      • getInstanceId

        @NotNull
        public @NotNull java.lang.String getInstanceId()
        Returns:
        instance uuid.
      • getRequestId

        @NotNull
        public @NotNull java.lang.String getRequestId()
        Returns:
        request uuid.
      • getVersion

        @NotNull
        public @NotNull java.lang.String getVersion()
        Returns:
        version of the SDK.
      • stop

        @Deprecated
        public void stop()
        Deprecated.
        Stop the SDK and terminate all listeners.
      • destroy

        public void destroy()
        Destroy the SDK to cancel all ongoing requests and stop heartbeat timer.
      • forceDestroy

        public void forceDestroy()
        Force destroy the SDK to evict the connection pools and close executors.
      • reconnect

        public void reconnect()
        Perform a Reconnect to the network
      • disconnect

        public void disconnect()
        Perform a disconnect from the listeners
      • fire

        @NotNull
        public @NotNull Publish fire()
      • getSubscribedChannels

        @NotNull
        public @NotNull java.util.List<java.lang.String> getSubscribedChannels()
      • getSubscribedChannelGroups

        @NotNull
        public @NotNull java.util.List<java.lang.String> getSubscribedChannelGroups()
      • unsubscribeAll

        public void unsubscribeAll()
      • setToken

        public void setToken​(java.lang.String token)
      • getConfiguration

        @NotNull
        public @NotNull PNConfiguration getConfiguration()