![JAR search and dependency download from the Maven repository](/logo.png)
com.pusher.client.PusherOptions.html Maven / Gradle / Ivy
PusherOptions (Pusher Java Websocket API)
com.pusher.client
Class PusherOptions
- java.lang.Object
-
- com.pusher.client.PusherOptions
-
public class PusherOptions
extends java.lang.Object
Configuration for a Pusher
instance.
-
-
Field Summary
Fields
Modifier and Type
Field and Description
static java.lang.String
LIB_VERSION
-
Constructor Summary
Constructors
Constructor and Description
PusherOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
java.lang.String
buildUrl(java.lang.String apiKey)
Construct the URL for the WebSocket connection based on the options
previous set on this object and the provided API key
long
getActivityTimeout()
Authorizer
getAuthorizer()
Gets the authorizer to be used when authenticating private and presence
channels.
long
getPongTimeout()
java.net.Proxy
getProxy()
boolean
isEncrypted()
Gets whether an encrypted (SSL) connection should be used when connecting
to Pusher.
PusherOptions
setActivityTimeout(long activityTimeout)
The number of milliseconds of inactivity at which a "ping" will be
triggered to check the connection.
PusherOptions
setAuthorizer(Authorizer authorizer)
Sets the authorizer to be used when authenticating private and presence
channels.
PusherOptions
setCluster(java.lang.String cluster)
PusherOptions
setEncrypted(boolean encrypted)
Sets whether an encrypted (SSL) connection should be used when connecting to
Pusher.
PusherOptions
setHost(java.lang.String host)
The host to which connections will be made.
PusherOptions
setPongTimeout(long pongTimeout)
The number of milliseconds after a "ping" is sent that the client will
wait to receive a "pong" response from the server before considering the
connection broken and triggering a transition to the disconnected state.
PusherOptions
setProxy(java.net.Proxy proxy)
The default value is Proxy.NO_PROXY.
PusherOptions
setWsPort(int wsPort)
The port to which unencrypted connections will be made.
PusherOptions
setWssPort(int wssPort)
The port to which encrypted connections will be made.
-
-
Field Detail
-
LIB_VERSION
public static final java.lang.String LIB_VERSION
-
Constructor Detail
-
PusherOptions
public PusherOptions()
-
Method Detail
-
isEncrypted
public boolean isEncrypted()
Gets whether an encrypted (SSL) connection should be used when connecting
to Pusher.
- Returns:
- true if an encrypted connection should be used; otherwise false.
-
setEncrypted
public PusherOptions setEncrypted(boolean encrypted)
Sets whether an encrypted (SSL) connection should be used when connecting to
Pusher.
- Parameters:
encrypted
- Whether to use an SSL connection
- Returns:
- this, for chaining
-
getAuthorizer
public Authorizer getAuthorizer()
Gets the authorizer to be used when authenticating private and presence
channels.
- Returns:
- the authorizer
-
setAuthorizer
public PusherOptions setAuthorizer(Authorizer authorizer)
Sets the authorizer to be used when authenticating private and presence
channels.
- Parameters:
authorizer
- The authorizer to be used.
- Returns:
- this, for chaining
-
setHost
public PusherOptions setHost(java.lang.String host)
The host to which connections will be made.
Note that if you wish to connect to a standard Pusher cluster, the
convenience method setCluster will set the host and ports correctly from
a single argument.
- Parameters:
host
- The host
- Returns:
- this, for chaining
-
setWsPort
public PusherOptions setWsPort(int wsPort)
The port to which unencrypted connections will be made.
Note that if you wish to connect to a standard Pusher cluster, the
convenience method setCluster will set the host and ports correctly from
a single argument.
- Parameters:
wsPort
- port number
- Returns:
- this, for chaining
-
setWssPort
public PusherOptions setWssPort(int wssPort)
The port to which encrypted connections will be made.
Note that if you wish to connect to a standard Pusher cluster, the
convenience method setCluster will set the host and ports correctly from
a single argument.
- Parameters:
wssPort
- port number
- Returns:
- this, for chaining
-
setCluster
public PusherOptions setCluster(java.lang.String cluster)
-
setActivityTimeout
public PusherOptions setActivityTimeout(long activityTimeout)
The number of milliseconds of inactivity at which a "ping" will be
triggered to check the connection.
The default value is 120,000 (2 minutes). On some connections, where
intermediate hops between the application and Pusher are aggressively
culling connections they consider to be idle, a lower value may help
preserve the connection.
- Parameters:
activityTimeout
- time to consider connection idle, in milliseconds
- Returns:
- this, for chaining
-
getActivityTimeout
public long getActivityTimeout()
-
setPongTimeout
public PusherOptions setPongTimeout(long pongTimeout)
The number of milliseconds after a "ping" is sent that the client will
wait to receive a "pong" response from the server before considering the
connection broken and triggering a transition to the disconnected state.
The default value is 30,000.
- Parameters:
pongTimeout
- time to wait for pong response, in milliseconds
- Returns:
- this, for chaining
-
getPongTimeout
public long getPongTimeout()
-
buildUrl
public java.lang.String buildUrl(java.lang.String apiKey)
Construct the URL for the WebSocket connection based on the options
previous set on this object and the provided API key
- Parameters:
apiKey
- The API key
- Returns:
- the WebSocket URL
-
setProxy
public PusherOptions setProxy(java.net.Proxy proxy)
The default value is Proxy.NO_PROXY.
- Parameters:
proxy
- Specify a proxy, e.g. options.setProxy( new Proxy( Proxy.Type.HTTP, new InetSocketAddress( "proxyaddress", 80 ) ) )
;
- Returns:
- this, for chaining
-
getProxy
public java.net.Proxy getProxy()
- Returns:
- The proxy to be used when opening a websocket connection to Pusher.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy