Package com.pubnub.api
Class PNConfiguration
- java.lang.Object
-
- com.pubnub.api.PNConfiguration
-
public class PNConfiguration extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description PNConfiguration(@NotNull UserId userId)Initialize the PNConfiguration with default valuesPNConfiguration(@NotNull java.lang.String uuid)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetAuthKey()okhttp3.CertificatePinnergetCertificatePinner()java.lang.StringgetCipherKey()Deprecated.UsecryptoModuleinstead.okhttp3.ConnectionSpecgetConnectionSpec()intgetConnectTimeout()Stores the maximum number of seconds which the client should wait for connection before timing out.com.pubnub.api.crypto.CryptoModulegetCryptoModule()intgetFileMessagePublishRetryLimit()java.lang.StringgetFilterExpression()filterExpression used as part of PSV2 specification.intgetHeartbeatInterval()In seconds, How often the client should announce it's existence via heartbeating.@Nullable PNHeartbeatNotificationOptionsgetHeartbeatNotificationOptions()verbosity of heartbeat configuration, by default only alerts on failed heartbeatsjavax.net.ssl.HostnameVerifiergetHostnameVerifier()okhttp3.logging.HttpLoggingInterceptorgetHttpLoggingInterceptor()@NotNull PNLogVerbositygetLogVerbosity()toggle to enable verbose logging.java.lang.IntegergetMaximumConnections()java.lang.IntegergetMaximumMessagesCacheSize()intgetMaximumReconnectionRetries()Set how many times the reconnection manager will try to connect before giving up.intgetNonSubscribeRequestTimeout()Reference on number of seconds which is used by client during non-subscription operations to check whether response potentially failed with 'timeout' or not.java.lang.StringgetOrigin()By default, the origin is pointing directly to PubNub servers.intgetPresenceTimeout()In seconds, how long the server will consider this client to be online before issuing a leave event.java.net.ProxygetProxy()Proxy configuration which will be passed to the networking layer.okhttp3.AuthenticatorgetProxyAuthenticator()java.net.ProxySelectorgetProxySelector()java.lang.StringgetPublishKey()Publish Key provided by PubNub.@Nullable PNReconnectionPolicygetReconnectionPolicy()Reconnection policy which will be used if/when networking goes downjava.lang.IntegergetRequestMessageCountThreshold()if set, the SDK will alert once the number of messages arrived in one call equal to the thresholdjava.lang.StringgetSecretKey()javax.net.ssl.SSLSocketFactorygetSslSocketFactory()java.lang.StringgetSubscribeKey()Subscribe Key provided by PubNubintgetSubscribeTimeout()UserIdgetUserId()java.lang.StringgetUuid()Deprecated.UsegetUserId()instead.javax.net.ssl.X509ExtendedTrustManagergetX509ExtendedTrustManager()booleanisCacheBusting()Deprecated.booleanisDedupOnSubscribe()booleanisGoogleAppEngineNetworking()Use Google App Engine based networking configurationbooleanisIncludeInstanceIdentifier()Set to true to send a UUID for PubNub instancebooleanisIncludeRequestIdentifier()Set to true to send a UUID on each requestbooleanisManagePresenceListManually()Deprecated.booleanisSecure()set to true to switch the client to HTTPS:// based communications.booleanisStartSubscriberThread()booleanisSuppressLeaveEvents()Suppress leave events when a channel gets disconnectedbooleanisUseRandomInitializationVector()Deprecated.UsecryptoModuleinstead.PNConfigurationsetAuthKey(java.lang.String authKey)PNConfigurationsetCacheBusting(boolean cacheBusting)Deprecated.PNConfigurationsetCertificatePinner(okhttp3.CertificatePinner certificatePinner)PNConfigurationsetCipherKey(java.lang.String cipherKey)Deprecated.UsecryptoModuleinstead.PNConfigurationsetConnectionSpec(okhttp3.ConnectionSpec connectionSpec)PNConfigurationsetConnectTimeout(int connectTimeout)Stores the maximum number of seconds which the client should wait for connection before timing out.PNConfigurationsetCryptoModule(com.pubnub.api.crypto.CryptoModule cryptoModule)CryptoModule is responsible for handling encryption and decryption.PNConfigurationsetDedupOnSubscribe(boolean dedupOnSubscribe)PNConfigurationsetFileMessagePublishRetryLimit(int fileMessagePublishRetryLimit)PNConfigurationsetFilterExpression(java.lang.String filterExpression)filterExpression used as part of PSV2 specification.PNConfigurationsetGoogleAppEngineNetworking(boolean googleAppEngineNetworking)Use Google App Engine based networking configurationPNConfigurationsetHeartbeatNotificationOptions(@Nullable PNHeartbeatNotificationOptions heartbeatNotificationOptions)verbosity of heartbeat configuration, by default only alerts on failed heartbeatsPNConfigurationsetHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)PNConfigurationsetHttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor httpLoggingInterceptor)PNConfigurationsetIncludeInstanceIdentifier(boolean includeInstanceIdentifier)Set to true to send a UUID for PubNub instancePNConfigurationsetIncludeRequestIdentifier(boolean includeRequestIdentifier)Set to true to send a UUID on each requestPNConfigurationsetLogVerbosity(@NotNull PNLogVerbosity logVerbosity)toggle to enable verbose logging.PNConfigurationsetManagePresenceListManually(boolean managePresenceListManually)Deprecated.PNConfigurationsetMaximumConnections(java.lang.Integer maximumConnections)PNConfigurationsetMaximumMessagesCacheSize(java.lang.Integer maximumMessagesCacheSize)PNConfigurationsetMaximumReconnectionRetries(int maximumReconnectionRetries)Set how many times the reconnection manager will try to connect before giving up.PNConfigurationsetNonSubscribeRequestTimeout(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.PNConfigurationsetOrigin(java.lang.String origin)By default, the origin is pointing directly to PubNub servers.PNConfigurationsetPresenceTimeout(int timeout)set presence configurations for timeout and allow the client to pick the best intervalPNConfigurationsetPresenceTimeoutWithCustomInterval(int timeout, int interval)set presence configurations for timeout and announce interval.PNConfigurationsetProxy(java.net.Proxy proxy)Proxy configuration which will be passed to the networking layer.PNConfigurationsetProxyAuthenticator(okhttp3.Authenticator proxyAuthenticator)PNConfigurationsetProxySelector(java.net.ProxySelector proxySelector)PNConfigurationsetPublishKey(java.lang.String publishKey)Publish Key provided by PubNub.PNConfigurationsetReconnectionPolicy(@Nullable PNReconnectionPolicy reconnectionPolicy)Reconnection policy which will be used if/when networking goes downPNConfigurationsetRequestMessageCountThreshold(java.lang.Integer requestMessageCountThreshold)if set, the SDK will alert once the number of messages arrived in one call equal to the thresholdPNConfigurationsetSecretKey(java.lang.String secretKey)PNConfigurationsetSecure(boolean secure)set to true to switch the client to HTTPS:// based communications.PNConfigurationsetSslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)PNConfigurationsetStartSubscriberThread(boolean startSubscriberThread)PNConfigurationsetSubscribeKey(java.lang.String subscribeKey)Subscribe Key provided by PubNubPNConfigurationsetSubscribeTimeout(int subscribeTimeout)PNConfigurationsetSuppressLeaveEvents(boolean suppressLeaveEvents)Suppress leave events when a channel gets disconnectedPNConfigurationsetUseRandomInitializationVector(boolean useRandomInitializationVector)Deprecated.UsecryptoModuleinstead.voidsetUserId(@NotNull UserId userId)voidsetUuid(@NotNull java.lang.String uuid)Deprecated.UsesetUserId(UserId)instead.PNConfigurationsetX509ExtendedTrustManager(javax.net.ssl.X509ExtendedTrustManager x509ExtendedTrustManager)
-
-
-
Constructor Detail
-
PNConfiguration
public PNConfiguration(@NotNull @NotNull UserId userId) throws PubNubExceptionInitialize the PNConfiguration with default values- Parameters:
userId-- Throws:
PubNubException
-
PNConfiguration
@Deprecated public PNConfiguration(@NotNull @NotNull java.lang.String uuid) throws PubNubExceptionDeprecated.Initialize the PNConfiguration with default values- Parameters:
uuid-- Throws:
PubNubException
-
-
Method Detail
-
getCryptoModule
public com.pubnub.api.crypto.CryptoModule getCryptoModule()
-
setUuid
public void setUuid(@NotNull @NotNull java.lang.String uuid)Deprecated.UsesetUserId(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.UsecryptoModuleinstead.
-
isUseRandomInitializationVector
@Deprecated public boolean isUseRandomInitializationVector()
Deprecated.UsecryptoModuleinstead.
-
getUuid
@Deprecated public java.lang.String getUuid()
Deprecated.UsegetUserId()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 usingPubNub.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.UsecryptoModuleinstead.- Returns:
this.
-
setUseRandomInitializationVector
@Deprecated public PNConfiguration setUseRandomInitializationVector(boolean useRandomInitializationVector)
Deprecated.UsecryptoModuleinstead.- 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 usingPubNub.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
-
-