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.String
getAuthKey()
okhttp3.CertificatePinner
getCertificatePinner()
java.lang.String
getCipherKey()
Deprecated.UsecryptoModule
instead.okhttp3.ConnectionSpec
getConnectionSpec()
int
getConnectTimeout()
Stores the maximum number of seconds which the client should wait for connection before timing out.com.pubnub.api.crypto.CryptoModule
getCryptoModule()
int
getFileMessagePublishRetryLimit()
java.lang.String
getFilterExpression()
filterExpression used as part of PSV2 specification.int
getHeartbeatInterval()
In seconds, How often the client should announce it's existence via heartbeating.@Nullable PNHeartbeatNotificationOptions
getHeartbeatNotificationOptions()
verbosity of heartbeat configuration, by default only alerts on failed heartbeatsjavax.net.ssl.HostnameVerifier
getHostnameVerifier()
okhttp3.logging.HttpLoggingInterceptor
getHttpLoggingInterceptor()
@NotNull PNLogVerbosity
getLogVerbosity()
toggle to enable verbose logging.java.lang.Integer
getMaximumConnections()
java.lang.Integer
getMaximumMessagesCacheSize()
int
getMaximumReconnectionRetries()
Set how many times the reconnection manager will try to connect before giving up.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.java.lang.String
getOrigin()
By default, the origin is pointing directly to PubNub servers.int
getPresenceTimeout()
In seconds, how long the server will consider this client to be online before issuing a leave event.java.net.Proxy
getProxy()
Proxy configuration which will be passed to the networking layer.okhttp3.Authenticator
getProxyAuthenticator()
java.net.ProxySelector
getProxySelector()
java.lang.String
getPublishKey()
Publish Key provided by PubNub.@Nullable PNReconnectionPolicy
getReconnectionPolicy()
Reconnection policy which will be used if/when networking goes downjava.lang.Integer
getRequestMessageCountThreshold()
if set, the SDK will alert once the number of messages arrived in one call equal to the thresholdjava.lang.String
getSecretKey()
javax.net.ssl.SSLSocketFactory
getSslSocketFactory()
java.lang.String
getSubscribeKey()
Subscribe Key provided by PubNubint
getSubscribeTimeout()
UserId
getUserId()
java.lang.String
getUuid()
Deprecated.UsegetUserId()
instead.javax.net.ssl.X509ExtendedTrustManager
getX509ExtendedTrustManager()
boolean
isCacheBusting()
Deprecated.boolean
isDedupOnSubscribe()
boolean
isGoogleAppEngineNetworking()
Use Google App Engine based networking configurationboolean
isIncludeInstanceIdentifier()
Set to true to send a UUID for PubNub instanceboolean
isIncludeRequestIdentifier()
Set to true to send a UUID on each requestboolean
isManagePresenceListManually()
Deprecated.boolean
isSecure()
set to true to switch the client to HTTPS:// based communications.boolean
isStartSubscriberThread()
boolean
isSuppressLeaveEvents()
Suppress leave events when a channel gets disconnectedboolean
isUseRandomInitializationVector()
Deprecated.UsecryptoModule
instead.PNConfiguration
setAuthKey(java.lang.String authKey)
PNConfiguration
setCacheBusting(boolean cacheBusting)
Deprecated.PNConfiguration
setCertificatePinner(okhttp3.CertificatePinner certificatePinner)
PNConfiguration
setCipherKey(java.lang.String cipherKey)
Deprecated.UsecryptoModule
instead.PNConfiguration
setConnectionSpec(okhttp3.ConnectionSpec connectionSpec)
PNConfiguration
setConnectTimeout(int connectTimeout)
Stores the maximum number of seconds which the client should wait for connection before timing out.PNConfiguration
setCryptoModule(com.pubnub.api.crypto.CryptoModule cryptoModule)
CryptoModule is responsible for handling encryption and decryption.PNConfiguration
setDedupOnSubscribe(boolean dedupOnSubscribe)
PNConfiguration
setFileMessagePublishRetryLimit(int fileMessagePublishRetryLimit)
PNConfiguration
setFilterExpression(java.lang.String filterExpression)
filterExpression used as part of PSV2 specification.PNConfiguration
setGoogleAppEngineNetworking(boolean googleAppEngineNetworking)
Use Google App Engine based networking configurationPNConfiguration
setHeartbeatNotificationOptions(@Nullable PNHeartbeatNotificationOptions heartbeatNotificationOptions)
verbosity of heartbeat configuration, by default only alerts on failed heartbeatsPNConfiguration
setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
PNConfiguration
setHttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor httpLoggingInterceptor)
PNConfiguration
setIncludeInstanceIdentifier(boolean includeInstanceIdentifier)
Set to true to send a UUID for PubNub instancePNConfiguration
setIncludeRequestIdentifier(boolean includeRequestIdentifier)
Set to true to send a UUID on each requestPNConfiguration
setLogVerbosity(@NotNull PNLogVerbosity logVerbosity)
toggle to enable verbose logging.PNConfiguration
setManagePresenceListManually(boolean managePresenceListManually)
Deprecated.PNConfiguration
setMaximumConnections(java.lang.Integer maximumConnections)
PNConfiguration
setMaximumMessagesCacheSize(java.lang.Integer maximumMessagesCacheSize)
PNConfiguration
setMaximumReconnectionRetries(int maximumReconnectionRetries)
Set how many times the reconnection manager will try to connect before giving up.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.PNConfiguration
setOrigin(java.lang.String origin)
By default, the origin is pointing directly to PubNub servers.PNConfiguration
setPresenceTimeout(int timeout)
set presence configurations for timeout and allow the client to pick the best intervalPNConfiguration
setPresenceTimeoutWithCustomInterval(int timeout, int interval)
set presence configurations for timeout and announce interval.PNConfiguration
setProxy(java.net.Proxy proxy)
Proxy configuration which will be passed to the networking layer.PNConfiguration
setProxyAuthenticator(okhttp3.Authenticator proxyAuthenticator)
PNConfiguration
setProxySelector(java.net.ProxySelector proxySelector)
PNConfiguration
setPublishKey(java.lang.String publishKey)
Publish Key provided by PubNub.PNConfiguration
setReconnectionPolicy(@Nullable PNReconnectionPolicy reconnectionPolicy)
Reconnection policy which will be used if/when networking goes downPNConfiguration
setRequestMessageCountThreshold(java.lang.Integer requestMessageCountThreshold)
if set, the SDK will alert once the number of messages arrived in one call equal to the thresholdPNConfiguration
setSecretKey(java.lang.String secretKey)
PNConfiguration
setSecure(boolean secure)
set to true to switch the client to HTTPS:// based communications.PNConfiguration
setSslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
PNConfiguration
setStartSubscriberThread(boolean startSubscriberThread)
PNConfiguration
setSubscribeKey(java.lang.String subscribeKey)
Subscribe Key provided by PubNubPNConfiguration
setSubscribeTimeout(int subscribeTimeout)
PNConfiguration
setSuppressLeaveEvents(boolean suppressLeaveEvents)
Suppress leave events when a channel gets disconnectedPNConfiguration
setUseRandomInitializationVector(boolean useRandomInitializationVector)
Deprecated.UsecryptoModule
instead.void
setUserId(@NotNull UserId userId)
void
setUuid(@NotNull java.lang.String uuid)
Deprecated.UsesetUserId(UserId)
instead.PNConfiguration
setX509ExtendedTrustManager(javax.net.ssl.X509ExtendedTrustManager x509ExtendedTrustManager)
-
-
-
Constructor Detail
-
PNConfiguration
public PNConfiguration(@NotNull @NotNull UserId userId) throws PubNubException
Initialize the PNConfiguration with default values- Parameters:
userId
-- Throws:
PubNubException
-
PNConfiguration
@Deprecated public PNConfiguration(@NotNull @NotNull java.lang.String uuid) throws PubNubException
Deprecated.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.UsecryptoModule
instead.
-
isUseRandomInitializationVector
@Deprecated public boolean isUseRandomInitializationVector()
Deprecated.UsecryptoModule
instead.
-
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.UsecryptoModule
instead.- Returns:
this
.
-
setUseRandomInitializationVector
@Deprecated public PNConfiguration setUseRandomInitializationVector(boolean useRandomInitializationVector)
Deprecated.UsecryptoModule
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 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
-
-