public class ConnectionOptions
extends java.lang.Object
LightstreamerClient
as LightstreamerClient.connectionOptions
LightstreamerClient
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getConnectTimeout()
Deprecated.
The method is deprecated: use
getRetryDelay() instead. |
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 maximum time to wait for a response to a request.
|
long |
getFirstRetryMaxDelay()
Inquiry method that gets the maximum time to wait before trying a new connection to the Server
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.
|
long |
getPollingInterval()
Inquiry method that gets the polling interval used for polling connections.
|
java.lang.String |
getRealMaxBandwidth()
Inquiry method that gets the maximum bandwidth that can be consumed for the data coming from
Lightstreamer Server.
|
long |
getReconnectTimeout()
Inquiry method that gets the time the client, after entering "STALLED" status,
is allowed to keep waiting for a keepalive packet or any data on a stream connection,
before disconnecting and trying to reconnect to the Server.
|
java.lang.String |
getRequestedMaxBandwidth()
Inquiry method that gets the maximum bandwidth that can be consumed for the data coming from
Lightstreamer Server, as requested for this session.
|
long |
getRetryDelay()
Inquiry method that gets the minimum time to wait before trying a new connection
to the Server in case the previous one failed for any reason, which is also the maximum time to wait for a response to a request
before dropping the connection and trying with a different approach.
|
long |
getReverseHeartbeatInterval()
Inquiry method that gets the reverse-heartbeat interval expressed in milliseconds.
|
long |
getSessionRecoveryTimeout()
Inquiry method that gets the maximum time allowed for attempts to recover
the current session upon an interruption, after which a new session will be created.
|
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)
Deprecated.
The method is deprecated and it has no effect.
To act on connection timeouts use
setRetryDelay(long) . |
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)
Deprecated.
The method is deprecated and it has no effect.
To act on connection timeouts, only
setRetryDelay(long) is available. |
void |
setEarlyWSOpenEnabled(boolean earlyWSOpenEnabled)
Setter method that enables/disables the "early-open" of the WebSocket connection.
|
void |
setFirstRetryMaxDelay(long firstRetryMaxDelay)
Setter method that sets the maximum time to wait before trying a new connection to the Server
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.
|
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 |
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 keep waiting for a keepalive packet or any data on a stream connection,
before disconnecting and trying to reconnect to the Server.
|
void |
setRequestedMaxBandwidth(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 |
setRetryDelay(long retryDelay)
Setter method that sets
the minimum time to wait before trying a new connection
to the Server in case the previous one failed for any reason; and
the maximum time to wait for a response to a request
before dropping the connection and trying with a different approach.
Enforcing a delay between reconnections prevents strict loops of connection attempts when these attempts always fail immediately because of some persisting issue. |
void |
setReverseHeartbeatInterval(long reverseHeartbeatInterval)
Setter method that enables/disables the reverse-heartbeat mechanism 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.
|
void |
setSessionRecoveryTimeout(long sessionRecoveryTimeout)
Setter method that sets the maximum time allowed for attempts to recover
the current session upon an interruption, after which a new session will be created.
|
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.
|
@Nonnull @Deprecated public java.lang.String getConnectTimeout()
getRetryDelay()
instead.getRetryDelay()
.getRetryDelay()
.public long getCurrentConnectTimeout()
LightstreamerClient.disconnect()
and LightstreamerClient.connect()
it will restart from the retry delay.setRetryDelay(long)
public long getContentLength()
setContentLength(long)
public long getFirstRetryMaxDelay()
setFirstRetryMaxDelay(long)
@Nullable public java.lang.String getForcedTransport()
setForcedTransport(String)
@Nullable 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)
@Nonnull public java.lang.String getRequestedMaxBandwidth()
getRealMaxBandwidth()
setRequestedMaxBandwidth(String)
@Nullable public java.lang.String getRealMaxBandwidth()
getRequestedMaxBandwidth()
. setRequestedMaxBandwidth(String)
ClientListener.onPropertyChange(java.lang.String)
with argument "realMaxBandwidth".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 long getSessionRecoveryTimeout()
setSessionRecoveryTimeout(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)
@Deprecated public void setConnectTimeout(@Nonnull java.lang.String connectTimeout)
setRetryDelay(long)
.connectTimeout
- ignored.@Deprecated public void setCurrentConnectTimeout(long connectTimeout)
setRetryDelay(long)
is available.connectTimeout
- ignored.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.connect()
method. However, the value can be changed at any time: the supplied value will
be used for the next streaming connection (either a bind or a brand new session).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)
ClientListener.onPropertyChange(java.lang.String)
with argument "earlyWSOpenEnabled" on any
ClientListener listening to the related LightstreamerClient.public void setFirstRetryMaxDelay(long firstRetryMaxDelay)
setRetryDelay(long)
will be applied.firstRetryMaxDelay
- The max time (in milliseconds) to wait before trying a new connection.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(@Nullable 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(@Nullable java.util.Map<java.lang.String,java.lang.String> httpExtraHeaders)
LightstreamerClient.addCookies(java.net.URI, java.util.List<java.net.HttpCookie>)
instead.
The use of custom headers might also cause the
client to send an OPTIONS request to the server before opening the actual connection.httpExtraHeaders
- a Map object containing header-name header-value pairs. Null can be specified to avoid extra
headers to be sent.LightstreamerClient.connect()
method. However, the value can be changed
at any time: the supplied value will be used for the next HTTP request or WebSocket establishment.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.LightstreamerClient.connect()
method. However, the value can be changed
at any time: the supplied value will be used for the next HTTP request or WebSocket establishment.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.connect()
method. However, the value can be changed at any time: the supplied value
will be used for the next polling request.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 set, or 0.java.lang.IllegalArgumentException
- if a negative value is configuredsetStalledTimeout(long)
,
setReconnectTimeout(long)
LightstreamerClient.connect()
method. However, the value can be changed at any time: the supplied
value will be used for the next streaming connection (either a bind or a brand new session). ClientListener.onPropertyChange(java.lang.String)
with argument "keepaliveInterval" on any
ClientListener listening to the related LightstreamerClient.public void setRequestedMaxBandwidth(@Nonnull java.lang.String maxBandwidth)
maxBandwidth
- A decimal number, which represents 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 entirely 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.getRealMaxBandwidth()
ClientListener.onPropertyChange(java.lang.String)
with argument "requestedMaxBandwidth" on any
ClientListener listening to the related LightstreamerClient. ClientListener.onPropertyChange(java.lang.String)
with argument "realMaxBandwidth" 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.connect()
method. However, the value can be changed at any time: the supplied value will
be used for the next polling request. 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)
setFirstRetryMaxDelay(long)
will apply in this case).
As another consequence, when a connection attempt gets no answer and times out,
the new attempt will be immediate.retryDelay
- The time (in milliseconds) to wait before trying a new connection.java.lang.IllegalArgumentException
- if a negative or zero value is configuredsetFirstRetryMaxDelay(long)
,
getCurrentConnectTimeout()
ClientListener.onPropertyChange(java.lang.String)
with argument "retryDelay" on any
ClientListener listening to the related LightstreamerClient.public void setReverseHeartbeatInterval(long reverseHeartbeatInterval)
setIdleTimeout(long)
setting
has a similar function.setIdleTimeout(long)
setting has a similar function.reverseHeartbeatInterval
- the interval, expressed in milliseconds, between subsequent reverse-heartbeats, or 0.java.lang.IllegalArgumentException
- if a negative value is configuredLightstreamerClient.connect()
method. However, the value can be changed
at any time: the setting will be obeyed immediately, unless a higher heartbeat
frequency was notified to the Server for the current connection. The setting
will always be obeyed upon the next connection (either a bind or a brand new session).ClientListener.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.connect()
method. However, the value can be changed at any time: the supplied value will
be used for the next streaming connection (either a bind or a brand new session).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 setSessionRecoveryTimeout(long sessionRecoveryTimeout)
sessionRecoveryTimeout
- The maximum time allowed
for recovery attempts, expressed in milliseconds, including 0.java.lang.IllegalArgumentException
- if a negative value is passed.ClientListener.onPropertyChange(java.lang.String)
with argument "sessionRecoveryTimeout" 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.