public class ConnectionOptions
extends java.lang.Object
LightstreamerClient
as LightstreamerClient.connectionOptions
LightstreamerClient
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getConnectTimeout()
Inquiry method that gets the extra time the client can wait for a response on an opened connection.
|
long |
getContentLength()
Inquiry method that gets the length expressed in bytes to be used by the Server for the response body on
a HTTP stream connection.
|
long |
getCurrentConnectTimeout()
Inquiry method that gets the extra time the client can wait for a response on an opened connection.
|
long |
getFirstRetryMaxDelay()
Inquiry method that gets the maximum time the client will wait before opening a new session in case the
previous one is unexpectedly closed while correctly working.
|
java.lang.String |
getForcedTransport()
Inquiry method that gets the value of the forced transport (if any).
|
java.util.Map<java.lang.String,java.lang.String> |
getHttpExtraHeaders()
Inquiry method that gets the Map object containing the extra headers to be sent to the server.
|
long |
getIdleTimeout()
Inquiry method that gets the maximum time the Server is allowed to wait for any data to be sent
in response to a polling request, if none has accumulated at request time.
|
long |
getKeepaliveInterval()
Inquiry method that gets the interval between two keepalive packets sent by Lightstreamer Server
on a stream connection when no actual data is being transmitted.
If the value has just been set and a connection to Lightstreamer Server has not been established yet, the returned value is the time that is being requested to the Server. |
java.lang.String |
getMaxBandwidth()
Inquiry method that gets the maximum bandwidth that can be consumed for the data coming from
Lightstreamer Server.
If the value has just been set and a connection to Lightstreamer Server has not been established yet, the returned value is the bandwidth limit that is being requested to the Server. |
long |
getPollingInterval()
Inquiry method that gets the polling interval used for polling connections.
If the value has just been set and a polling request to Lightstreamer Server has not been performed yet, the returned value is the polling interval that is being requested to the Server. |
long |
getReconnectTimeout()
Inquiry method that gets the time the client, after entering "STALLED" status, can wait for a keepalive
packet or any data on a stream connection, before disconnecting and trying to reconnect to the Server.
|
long |
getRetryDelay()
Inquiry method that gets the time the client can wait before opening a new session in case the previous
one failed to open or was closed before it became stable.
|
long |
getReverseHeartbeatInterval()
Inquiry method that gets the reverse-heartbeat interval expressed in milliseconds.
|
long |
getStalledTimeout()
Inquiry method that gets the extra time the client can wait when an expected keepalive packet
has not been received on a stream connection (and no actual data has arrived), before entering
the "STALLED" status.
|
boolean |
isEarlyWSOpenEnabled()
Inquiry method that checks if the client is going to early-open the WebSocket connection to the
address specified in
ConnectionDetails.setServerAddress(String) . |
boolean |
isHttpExtraHeadersOnSessionCreationOnly()
Inquiry method that checks if the restriction on the forwarding of the configured extra http headers
applies or not.
|
boolean |
isServerInstanceAddressIgnored()
Inquiry method that checks if the client is going to ignore the server instance address that
will possibly be sent by the server.
|
boolean |
isSlowingEnabled()
Inquiry method that checks if the slowing algorithm is enabled or not.
|
void |
setConnectTimeout(java.lang.String connectTimeout)
Setter method that sets the time the client is allowed to wait for a response to a request
before dropping the connection and try with a different approach.
|
void |
setContentLength(long contentLength)
Setter method that sets the length in bytes to be used by the Server for the response body on a stream connection
(a minimum length, however, is ensured by the server).
|
void |
setCurrentConnectTimeout(long connectTimeout)
Setter method that sets the time the client is allowed to wait for a response to a request
before dropping the connection and try with a different approach.
|
void |
setEarlyWSOpenEnabled(boolean earlyWSOpenEnabled)
Setter method that enables/disables the "early-open" of the WebSocket connection.
When enabled a WebSocket is open to the address specified through ConnectionDetails.setServerAddress(java.lang.String) before
a potential server instance address is received during session creation. |
void |
setFirstRetryMaxDelay(long firstRetryMaxDelay)
Setter method that sets the maximum time to wait before opening a new session in case the previous one is
unexpectedly closed while correctly working.
|
void |
setForcedTransport(java.lang.String forcedTransport)
Setter method that can be used to disable/enable the Stream-Sense algorithm and to force the client to use a fixed
transport or a fixed combination of a transport and a connection type.
|
void |
setHttpExtraHeaders(java.util.Map<java.lang.String,java.lang.String> httpExtraHeaders)
Setter method that enables/disables the setting of extra HTTP headers to all the request performed to the Lightstreamer
server by the client.
Note that the Content-Type header is reserved by the client library itself, while other headers might be refused by the environment and others might cause the connection to the server to fail. |
void |
setHttpExtraHeadersOnSessionCreationOnly(boolean httpExtraHeadersOnSessionCreationOnly)
Setter method that enables/disables a restriction on the forwarding of the extra http headers specified through
setHttpExtraHeaders(Map) . |
void |
setIdleTimeout(long idleTimeout)
Setter method that sets the maximum time the Server is allowed to wait for any data to be sent in response to a
polling request, if none has accumulated at request time.
|
void |
setKeepaliveInterval(long keepaliveInterval)
Setter method that sets the interval between two keepalive packets to be sent by Lightstreamer Server on a stream
connection when no actual data is being transmitted.
|
void |
setMaxBandwidth(java.lang.String maxBandwidth)
Setter method that sets the maximum bandwidth expressed in kilobits/s that can be consumed for the data coming from
Lightstreamer Server.
|
void |
setPollingInterval(long pollingInterval)
Setter method that sets the polling interval used for polling connections.
|
void |
setProxy(Proxy proxy)
Setter method that configures the coordinates to a proxy server to be used to connect to the Lightstreamer Server.
|
void |
setReconnectTimeout(long reconnectTimeout)
Setter method that sets the time the client, after entering "STALLED" status, is allowed to wait for a keepalive
packet or any data on a stream connection, before disconnecting and trying to reconnect to the Server.
|
void |
setRetryDelay(long retryDelay)
Setter method that sets the time to wait before opening a new session in case the previous one failed to open
or was closed before it became stable.
|
void |
setReverseHeartbeatInterval(long reverseHeartbeatInterval)
Setter method that enables/disables the reverse-heartbeat mechanism on the control connection by setting the
heartbeat interval.
|
void |
setServerInstanceAddressIgnored(boolean serverInstanceAddressIgnored)
Setter method that can be used to disable/enable the automatic handling of server instance address that may
be returned by the Lightstreamer server during session creation.
In fact, when a Server cluster is in place, the Server address specified through ConnectionDetails.setServerAddress(String) can identify various Server instances; in order to
ensure that all requests related to a session are issued to the same Server instance, the Server can answer
to the session opening request by providing an address which uniquely identifies its own instance.Setting this value to true permits to ignore that address and to always connect through the address supplied in setServerAddress. |
void |
setSlowingEnabled(boolean slowingEnabled)
Setter method that turns on or off the slowing algorithm.
|
void |
setStalledTimeout(long stalledTimeout)
Setter method that sets the extra time the client is allowed to wait when an expected keepalive packet has not been
received on a stream connection (and no actual data has arrived), before entering the "STALLED" status.
|
public java.lang.String getConnectTimeout()
getCurrentConnectTimeout()
method.
The getCurrentConnectTimeout method can also be used to get the numeric form in a numeric data type
instead of getting it represented as a string.setConnectTimeout(java.lang.String)
public long getCurrentConnectTimeout()
setConnectTimeout(java.lang.String)
is set to "auto" this value might automatically changepublic long getContentLength()
setContentLength(long)
public long getFirstRetryMaxDelay()
setFirstRetryMaxDelay(long)
public java.lang.String getForcedTransport()
setForcedTransport(String)
public java.util.Map<java.lang.String,java.lang.String> getHttpExtraHeaders()
setHttpExtraHeaders(Map)
,
setHttpExtraHeadersOnSessionCreationOnly(boolean)
public long getIdleTimeout()
setIdleTimeout(long)
public long getKeepaliveInterval()
setKeepaliveInterval(long)
public java.lang.String getMaxBandwidth()
setMaxBandwidth(String)
public long getPollingInterval()
setPollingInterval(long)
public long getReconnectTimeout()
setReconnectTimeout(long)
public long getRetryDelay()
setRetryDelay(long)
public long getReverseHeartbeatInterval()
setReverseHeartbeatInterval(long)
public long getStalledTimeout()
setStalledTimeout(long)
public boolean isEarlyWSOpenEnabled()
ConnectionDetails.setServerAddress(String)
.setEarlyWSOpenEnabled(boolean)
public boolean isHttpExtraHeadersOnSessionCreationOnly()
setHttpExtraHeadersOnSessionCreationOnly(boolean)
,
setHttpExtraHeaders(Map)
public boolean isServerInstanceAddressIgnored()
setServerInstanceAddressIgnored(boolean)
public boolean isSlowingEnabled()
setSlowingEnabled(boolean)
public void setConnectTimeout(java.lang.String connectTimeout)
connectTimeout
- The time (in milliseconds) allowed before recovering a connection
that received no data.java.lang.IllegalArgumentException
- if a negative or zero value is configuredClientListener.onPropertyChange(java.lang.String)
with argument "connectTimeout" on any
ClientListener listening to the related LightstreamerClient.public void setCurrentConnectTimeout(long connectTimeout)
setConnectTimeout(java.lang.String)
is set to auto this value might be later changed by the library,
on the other hand if setConnectTimeout is configured to a fixed value this method will have no effectconnectTimeout
- The time (in milliseconds) allowed before recovering a connection
that received no data.java.lang.IllegalArgumentException
- if a negative or zero value is configuredClientListener.onPropertyChange(java.lang.String)
with argument "currentConnectTimeout" on any
ClientListener listening to the related LightstreamerClient.public void setContentLength(long contentLength)
contentLength
- The length to be used by the Server for the response body on a HTTP stream connection.java.lang.IllegalArgumentException
- if a negative or zero value is configuredLightstreamerClient.connectionOptions
object before calling
the LightstreamerClient.connect()
method. However, the value can be changed at any time: the supplied value will
be used for the next HTTP bind request.ClientListener.onPropertyChange(java.lang.String)
with argument "contentLength" on any
ClientListener listening to the related LightstreamerClient.public void setEarlyWSOpenEnabled(boolean earlyWSOpenEnabled)
ConnectionDetails.setServerAddress(java.lang.String)
before
a potential server instance address is received during session creation. In this case if a server instance address
is received, the previously open WebSocket is closed and a new one is open to the received server instance address.earlyWSOpenEnabled
- true/false to enable/disable the early-open of the WebSocket connection.setServerInstanceAddressIgnored(boolean)
setForcedTransport(String)
).ClientListener.onPropertyChange(java.lang.String)
with argument "earlyWSOpenEnabled" on any
ClientListener listening to the related LightstreamerClient.public void setFirstRetryMaxDelay(long firstRetryMaxDelay)
setRetryDelay(long)
is applied.firstRetryMaxDelay
- The max time (in milliseconds) to wait before opening a new session.java.lang.IllegalArgumentException
- if a negative or zero value is configuredClientListener.onPropertyChange(java.lang.String)
with argument "firstRetryMaxDelay" on any
ClientListener listening to the related LightstreamerClient.public void setForcedTransport(java.lang.String forcedTransport)
forcedTransport
- can be one of the following:
java.lang.IllegalArgumentException
- if the given value is not in the list of the admitted ones.ClientListener.onPropertyChange(java.lang.String)
with argument "forcedTransport" on any
ClientListener listening to the related LightstreamerClient.public void setHttpExtraHeaders(java.util.Map<java.lang.String,java.lang.String> httpExtraHeaders)
httpExtraHeaders
- a Map object containing header-name header-value pairs. Null can be specified to avoid extra
headers to be sent.ClientListener.onPropertyChange(java.lang.String)
with argument "httpExtraHeaders" on any
ClientListener listening to the related LightstreamerClient.public void setHttpExtraHeadersOnSessionCreationOnly(boolean httpExtraHeadersOnSessionCreationOnly)
setHttpExtraHeaders(Map)
. If true, said headers will only be sent during the session creation
process (and thus will still be available to the metadata adapter notifyUser method) but will not be sent on following
requests. On the contrary, when set to true, the specified extra headers will be sent to the server on every request.httpExtraHeadersOnSessionCreationOnly
- true/false to enable/disable the restriction on extra headers forwarding.ClientListener.onPropertyChange(java.lang.String)
with argument "httpExtraHeadersOnSessionCreationOnly" on any
ClientListener listening to the related LightstreamerClient.public void setIdleTimeout(long idleTimeout)
idleTimeout
- The time (in milliseconds) the Server is allowed to wait for data to send upon polling requests.java.lang.IllegalArgumentException
- if a negative value is configuredLightstreamerClient.connectionOptions
object before calling the
LightstreamerClient.connect()
method. However, the value can be changed at any time: the supplied value
will be used for the next polling request (this only applies to the "*-POLLING" cases).ClientListener.onPropertyChange(java.lang.String)
with argument "idleTimeout" on any
ClientListener listening to the related LightstreamerClient.public void setKeepaliveInterval(long keepaliveInterval)
keepaliveInterval
- the keepalive interval time (in milliseconds) to setjava.lang.IllegalArgumentException
- if a negative value is configuredsetStalledTimeout(long)
,
setReconnectTimeout(long)
LightstreamerClient.connectionOptions
object before
calling the LightstreamerClient.connect()
method. However, the value can be changed at any time: the supplied
value will be used for the next bind request (this only applies to the "*-STREAMING" cases).ClientListener.onPropertyChange(java.lang.String)
with argument "keepaliveInterval" on any
ClientListener listening to the related LightstreamerClient.public void setMaxBandwidth(java.lang.String maxBandwidth)
maxBandwidth
- The maximum bandwidth requested for the streaming or polling connection, expressed in
kbps (kilobits/sec). The string "unlimited" is also allowed, to mean that the maximum bandwidth can be decided on the
Server side (the check is case insensitive).java.lang.IllegalArgumentException
- if a negative, zero, or a not-number value (excluding special values) is passed.ClientListener.onPropertyChange(java.lang.String)
with argument "maxBandwidth" on any
ClientListener listening to the related LightstreamerClient.public void setPollingInterval(long pollingInterval)
setForcedTransport(java.lang.String)
with "WS-POLLING" or "HTTP-POLLING"
as parameter.pollingInterval
- The time (in milliseconds) between subsequent polling requests. Zero is a legal value too,
meaning that the client will issue a new polling request as soon as a previous one has returned.java.lang.IllegalArgumentException
- if a negative value is configuredLightstreamerClient.connectionOptions
object before calling
the LightstreamerClient.connect()
method. However, the value can be changed at any time: the supplied value will
be used for the next bind request (this only applies to the "*-POLLING" cases).ClientListener.onPropertyChange(java.lang.String)
with argument "pollingInterval" on any
ClientListener listening to the related LightstreamerClient.public void setReconnectTimeout(long reconnectTimeout)
reconnectTimeout
- The idle time (in milliseconds) allowed in "STALLED" status before trying
to reconnect to the Server.java.lang.IllegalArgumentException
- if a negative or zero value is configuredsetStalledTimeout(long)
,
setKeepaliveInterval(long)
ClientListener.onPropertyChange(java.lang.String)
with argument "reconnectTimeout" on any
ClientListener listening to the related LightstreamerClient.public void setRetryDelay(long retryDelay)
retryDelay
- The time (in milliseconds) to wait before opening a new session.java.lang.IllegalArgumentException
- if a negative or zero value is configuredClientListener.onPropertyChange(java.lang.String)
with argument "retryDelay" on any
ClientListener listening to the related LightstreamerClient.public void setReverseHeartbeatInterval(long reverseHeartbeatInterval)
reverseHeartbeatInterval
- the interval, expressed in milliseconds, between subsequent reverse-heartbeats.java.lang.IllegalArgumentException
- if a negative value is configuredClientListener.onPropertyChange(java.lang.String)
with argument "reverseHeartbeatInterval" on any
ClientListener listening to the related LightstreamerClient.public void setServerInstanceAddressIgnored(boolean serverInstanceAddressIgnored)
ConnectionDetails.setServerAddress(String)
can identify various Server instances; in order to
ensure that all requests related to a session are issued to the same Server instance, the Server can answer
to the session opening request by providing an address which uniquely identifies its own instance.serverInstanceAddressIgnored
- true or false, to ignore or not the server instance address sent by the server.ConnectionDetails.setServerAddress(String)
ClientListener.onPropertyChange(java.lang.String)
with argument "serverInstanceAddressIgnored" on any
ClientListener listening to the related LightstreamerClient.public void setSlowingEnabled(boolean slowingEnabled)
slowingEnabled
- true or false, to enable or disable the heuristic algorithm that lowers the item update frequency.LightstreamerClient.connectionOptions
object before
calling the LightstreamerClient#connect method. However, the value can be changed at any time: the supplied value will
be used for the next connection attempt.ClientListener.onPropertyChange(java.lang.String)
with argument "slowingEnabled" on any
ClientListener listening to the related LightstreamerClient.public void setStalledTimeout(long stalledTimeout)
stalledTimeout
- The idle time (in milliseconds) allowed before entering the "STALLED" status.java.lang.IllegalArgumentException
- if a negative or zero value is configuredsetReconnectTimeout(long)
,
setKeepaliveInterval(long)
ClientListener.onPropertyChange(java.lang.String)
with argument "stalledTimeout" on any
ClientListener listening to the related LightstreamerClient.public void setProxy(Proxy proxy)
proxy
- The proxy configuration. Specify null to avoid using a proxy.ClientListener.onPropertyChange(java.lang.String)
with argument "proxy" on any
ClientListener listening to the related LightstreamerClient.