Class PNConfiguration


  • public class PNConfiguration
    extends java.lang.Object
    • Method Detail

      • getCryptoModule

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

        public void setUuid​(@NotNull
                            @NotNull java.lang.String uuid)
        Deprecated.
        Use setUserId(UserId) instead.
      • getUserId

        public UserId getUserId()
      • setUserId

        public void setUserId​(@NotNull
                              @NotNull UserId userId)
      • setPresenceTimeoutWithCustomInterval

        public PNConfiguration setPresenceTimeoutWithCustomInterval​(int timeout,
                                                                    int interval)
        set presence configurations for timeout and announce interval.
        Parameters:
        timeout - presence timeout; how long before the server considers this client to be gone.
        interval - presence announce interval, how often the client should announce itself.
        Returns:
        returns itself.
      • setPresenceTimeout

        public PNConfiguration setPresenceTimeout​(int timeout)
        set presence configurations for timeout and allow the client to pick the best interval
        Parameters:
        timeout - presence timeout; how long before the server considers this client to be gone.
        Returns:
        returns itself.
      • getOrigin

        public java.lang.String getOrigin()
        By default, the origin is pointing directly to PubNub servers. If a proxy origin is needed, set a custom origin using this parameter.
      • getSubscribeTimeout

        public int getSubscribeTimeout()
      • getPresenceTimeout

        public int getPresenceTimeout()
        In seconds, how long the server will consider this client to be online before issuing a leave event.
      • getHeartbeatInterval

        public int getHeartbeatInterval()
        In seconds, How often the client should announce it's existence via heartbeating.
      • isSecure

        public boolean isSecure()
        set to true to switch the client to HTTPS:// based communications.
      • getSubscribeKey

        public java.lang.String getSubscribeKey()
        Subscribe Key provided by PubNub
      • getPublishKey

        public java.lang.String getPublishKey()
        Publish Key provided by PubNub.
      • getSecretKey

        public java.lang.String getSecretKey()
      • getAuthKey

        public java.lang.String getAuthKey()
      • getCipherKey

        @Deprecated
        public java.lang.String getCipherKey()
        Deprecated.
        Use cryptoModule instead.
      • isUseRandomInitializationVector

        @Deprecated
        public boolean isUseRandomInitializationVector()
        Deprecated.
        Use cryptoModule instead.
      • getUuid

        @Deprecated
        public java.lang.String getUuid()
        Deprecated.
        Use getUserId() instead.
      • isCacheBusting

        @Deprecated
        public boolean isCacheBusting()
        Deprecated.
        If proxies are forcefully caching requests, set to true to allow the client to randomize the subdomain. This configuration is not supported if custom origin is enabled.
      • getLogVerbosity

        @NotNull
        public @NotNull PNLogVerbosity getLogVerbosity()
        toggle to enable verbose logging.
      • getConnectTimeout

        public int getConnectTimeout()
        Stores the maximum number of seconds which the client should wait for connection before timing out.
      • getNonSubscribeRequestTimeout

        public int getNonSubscribeRequestTimeout()
        Reference on number of seconds which is used by client during non-subscription operations to check whether response potentially failed with 'timeout' or not.
      • isSuppressLeaveEvents

        public boolean isSuppressLeaveEvents()
        Suppress leave events when a channel gets disconnected
      • getHeartbeatNotificationOptions

        @Nullable
        public @Nullable PNHeartbeatNotificationOptions getHeartbeatNotificationOptions()
        verbosity of heartbeat configuration, by default only alerts on failed heartbeats
      • getFilterExpression

        public java.lang.String getFilterExpression()
        filterExpression used as part of PSV2 specification.
      • getReconnectionPolicy

        @Nullable
        public @Nullable PNReconnectionPolicy getReconnectionPolicy()
        Reconnection policy which will be used if/when networking goes down
      • getMaximumReconnectionRetries

        public int getMaximumReconnectionRetries()
        Set how many times the reconnection manager will try to connect before giving up. Default is -1 which means to retry infinitely.
      • getProxy

        public java.net.Proxy getProxy()
        Proxy configuration which will be passed to the networking layer.
      • getProxySelector

        public java.net.ProxySelector getProxySelector()
      • getProxyAuthenticator

        public okhttp3.Authenticator getProxyAuthenticator()
      • getCertificatePinner

        public okhttp3.CertificatePinner getCertificatePinner()
      • getMaximumConnections

        public java.lang.Integer getMaximumConnections()
      • getHttpLoggingInterceptor

        public okhttp3.logging.HttpLoggingInterceptor getHttpLoggingInterceptor()
      • getRequestMessageCountThreshold

        public java.lang.Integer getRequestMessageCountThreshold()
        if set, the SDK will alert once the number of messages arrived in one call equal to the threshold
      • isGoogleAppEngineNetworking

        public boolean isGoogleAppEngineNetworking()
        Use Google App Engine based networking configuration
      • isStartSubscriberThread

        public boolean isStartSubscriberThread()
      • isDedupOnSubscribe

        public boolean isDedupOnSubscribe()
      • getMaximumMessagesCacheSize

        public java.lang.Integer getMaximumMessagesCacheSize()
      • getFileMessagePublishRetryLimit

        public int getFileMessagePublishRetryLimit()
      • isManagePresenceListManually

        @Deprecated
        public boolean isManagePresenceListManually()
        Deprecated.
        Enables explicit presence control. When set to true heartbeat calls will contain only channels and groups added explicitly using PubNub.presence(). Should be used only with ACL set on the server side. For more information please contact PubNub support
        See Also:
        PubNub.presence(), heartbeatInterval
      • setSslSocketFactory

        public PNConfiguration setSslSocketFactory​(javax.net.ssl.SSLSocketFactory sslSocketFactory)
        Returns:
        this.
      • setX509ExtendedTrustManager

        public PNConfiguration setX509ExtendedTrustManager​(javax.net.ssl.X509ExtendedTrustManager x509ExtendedTrustManager)
        Returns:
        this.
      • setConnectionSpec

        public PNConfiguration setConnectionSpec​(okhttp3.ConnectionSpec connectionSpec)
        Returns:
        this.
      • setHostnameVerifier

        public PNConfiguration setHostnameVerifier​(javax.net.ssl.HostnameVerifier hostnameVerifier)
        Returns:
        this.
      • setIncludeInstanceIdentifier

        public PNConfiguration setIncludeInstanceIdentifier​(boolean includeInstanceIdentifier)
        Set to true to send a UUID for PubNub instance
        Returns:
        this.
      • setIncludeRequestIdentifier

        public PNConfiguration setIncludeRequestIdentifier​(boolean includeRequestIdentifier)
        Set to true to send a UUID on each request
        Returns:
        this.
      • setOrigin

        public PNConfiguration setOrigin​(java.lang.String origin)
        By default, the origin is pointing directly to PubNub servers. If a proxy origin is needed, set a custom origin using this parameter.
        Returns:
        this.
      • setSubscribeTimeout

        public PNConfiguration setSubscribeTimeout​(int subscribeTimeout)
        Returns:
        this.
      • setSecure

        public PNConfiguration setSecure​(boolean secure)
        set to true to switch the client to HTTPS:// based communications.
        Returns:
        this.
      • setSubscribeKey

        public PNConfiguration setSubscribeKey​(java.lang.String subscribeKey)
        Subscribe Key provided by PubNub
        Returns:
        this.
      • setPublishKey

        public PNConfiguration setPublishKey​(java.lang.String publishKey)
        Publish Key provided by PubNub.
        Returns:
        this.
      • setSecretKey

        public PNConfiguration setSecretKey​(java.lang.String secretKey)
        Returns:
        this.
      • setAuthKey

        public PNConfiguration setAuthKey​(java.lang.String authKey)
        Returns:
        this.
      • setCipherKey

        @Deprecated
        public PNConfiguration setCipherKey​(java.lang.String cipherKey)
        Deprecated.
        Use cryptoModule instead.
        Returns:
        this.
      • setUseRandomInitializationVector

        @Deprecated
        public PNConfiguration setUseRandomInitializationVector​(boolean useRandomInitializationVector)
        Deprecated.
        Use cryptoModule instead.
        Returns:
        this.
      • setCryptoModule

        public PNConfiguration setCryptoModule​(com.pubnub.api.crypto.CryptoModule cryptoModule)
        CryptoModule is responsible for handling encryption and decryption. If set, all communications to and from PubNub will be encrypted.
        Returns:
        this.
      • setCacheBusting

        @Deprecated
        public PNConfiguration setCacheBusting​(boolean cacheBusting)
        Deprecated.
        If proxies are forcefully caching requests, set to true to allow the client to randomize the subdomain. This configuration is not supported if custom origin is enabled.
        Returns:
        this.
      • setLogVerbosity

        public PNConfiguration setLogVerbosity​(@NotNull
                                               @NotNull PNLogVerbosity logVerbosity)
        toggle to enable verbose logging.
        Returns:
        this.
      • setConnectTimeout

        public PNConfiguration setConnectTimeout​(int connectTimeout)
        Stores the maximum number of seconds which the client should wait for connection before timing out.
        Returns:
        this.
      • setNonSubscribeRequestTimeout

        public PNConfiguration setNonSubscribeRequestTimeout​(int nonSubscribeRequestTimeout)
        Reference on number of seconds which is used by client during non-subscription operations to check whether response potentially failed with 'timeout' or not.
        Returns:
        this.
      • setSuppressLeaveEvents

        public PNConfiguration setSuppressLeaveEvents​(boolean suppressLeaveEvents)
        Suppress leave events when a channel gets disconnected
        Returns:
        this.
      • setHeartbeatNotificationOptions

        public PNConfiguration setHeartbeatNotificationOptions​(@Nullable
                                                               @Nullable PNHeartbeatNotificationOptions heartbeatNotificationOptions)
        verbosity of heartbeat configuration, by default only alerts on failed heartbeats
        Returns:
        this.
      • setRequestMessageCountThreshold

        public PNConfiguration setRequestMessageCountThreshold​(java.lang.Integer requestMessageCountThreshold)
        if set, the SDK will alert once the number of messages arrived in one call equal to the threshold
        Returns:
        this.
      • getSslSocketFactory

        public javax.net.ssl.SSLSocketFactory getSslSocketFactory()
      • getX509ExtendedTrustManager

        public javax.net.ssl.X509ExtendedTrustManager getX509ExtendedTrustManager()
      • getConnectionSpec

        public okhttp3.ConnectionSpec getConnectionSpec()
      • getHostnameVerifier

        public javax.net.ssl.HostnameVerifier getHostnameVerifier()
      • isIncludeInstanceIdentifier

        public boolean isIncludeInstanceIdentifier()
        Set to true to send a UUID for PubNub instance
      • isIncludeRequestIdentifier

        public boolean isIncludeRequestIdentifier()
        Set to true to send a UUID on each request
      • setFilterExpression

        public PNConfiguration setFilterExpression​(java.lang.String filterExpression)
        filterExpression used as part of PSV2 specification.
        Returns:
        this.
      • setReconnectionPolicy

        public PNConfiguration setReconnectionPolicy​(@Nullable
                                                     @Nullable PNReconnectionPolicy reconnectionPolicy)
        Reconnection policy which will be used if/when networking goes down
        Returns:
        this.
      • setMaximumReconnectionRetries

        public PNConfiguration setMaximumReconnectionRetries​(int maximumReconnectionRetries)
        Set how many times the reconnection manager will try to connect before giving up. Default is -1 which means to retry infinitely.
        Returns:
        this.
      • setProxy

        public PNConfiguration setProxy​(java.net.Proxy proxy)
        Proxy configuration which will be passed to the networking layer.
        Returns:
        this.
      • setProxySelector

        public PNConfiguration setProxySelector​(java.net.ProxySelector proxySelector)
        Returns:
        this.
      • setProxyAuthenticator

        public PNConfiguration setProxyAuthenticator​(okhttp3.Authenticator proxyAuthenticator)
        Returns:
        this.
      • setCertificatePinner

        public PNConfiguration setCertificatePinner​(okhttp3.CertificatePinner certificatePinner)
        Returns:
        this.
      • setMaximumConnections

        public PNConfiguration setMaximumConnections​(java.lang.Integer maximumConnections)
        Returns:
        this.
      • setHttpLoggingInterceptor

        public PNConfiguration setHttpLoggingInterceptor​(okhttp3.logging.HttpLoggingInterceptor httpLoggingInterceptor)
        Returns:
        this.
      • setGoogleAppEngineNetworking

        public PNConfiguration setGoogleAppEngineNetworking​(boolean googleAppEngineNetworking)
        Use Google App Engine based networking configuration
        Returns:
        this.
      • setStartSubscriberThread

        public PNConfiguration setStartSubscriberThread​(boolean startSubscriberThread)
        Returns:
        this.
      • setDedupOnSubscribe

        public PNConfiguration setDedupOnSubscribe​(boolean dedupOnSubscribe)
        Returns:
        this.
      • setMaximumMessagesCacheSize

        public PNConfiguration setMaximumMessagesCacheSize​(java.lang.Integer maximumMessagesCacheSize)
        Returns:
        this.
      • setFileMessagePublishRetryLimit

        public PNConfiguration setFileMessagePublishRetryLimit​(int fileMessagePublishRetryLimit)
        Returns:
        this.
      • setManagePresenceListManually

        @Deprecated
        public PNConfiguration setManagePresenceListManually​(boolean managePresenceListManually)
        Deprecated.
        Enables explicit presence control. When set to true heartbeat calls will contain only channels and groups added explicitly using PubNub.presence(). Should be used only with ACL set on the server side. For more information please contact PubNub support
        Returns:
        this.
        See Also:
        PubNub.presence(), heartbeatInterval