Class Policy
Object
|
+--Policy
- class
Policy
Bean object that contains the configuration settings about
connection constraints and fault recovery.
The class constructor, its prototype and any other properties should never
be used directly; actually, Policy is not even defined as a global name.
Defined in lscommons.js
See:
Constructor Summary |
Policy
()
Used by Lightstreamer to provide a connection policy properties
bean object to the LightstreamerEngine object.
|
Method Summary |
Number
|
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.
|
Number
|
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.
|
Number
|
getMaxBandwidth()
Inquiry method that gets the maximum bandwidth that can be consumed
for the data coming from Lightstreamer Server.
|
Number
|
getPollingInterval()
Inquiry method that gets the polling interval used for polling
connections.
|
Number
|
getTimeoutForReconnect()
Inquiry method that gets the time the client Engine, 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.
|
Number
|
getTimeoutForStalled()
Inquiry method that gets the extra time the client Engine 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.
|
void
|
setBufferedStreamingHandled()
|
void
|
setIdleTimeout(<Number> 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(<Number> 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(<Number> maxBandwidth)
Setter method that sets the maximum bandwidth that can be consumed
for the data coming from Lightstreamer Server.
|
void
|
setPollingInterval(<Number> pollingInterval)
Setter method that sets the polling interval used for polling
connections.
|
void
|
setSlowingEnabled(<boolean> slowingEnabled)
Setter method that turns on or off the slowing algorithm.
|
void
|
setTimeoutForReconnect(<Number> timeoutForReconnect)
Setter method that sets the time the client Engine, 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
|
setTimeoutForStalled(<Number> timeoutForStalled)
Setter method that sets the extra time the client Engine 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.
|
Policy
Policy()
Used by Lightstreamer to provide a connection policy properties
bean object to the LightstreamerEngine object.
getIdleTimeout
Number 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. The wait time used by the Server, however,
may be different, because of server side restrictions.
Returns:
The time (in milliseconds) the Server is allowed to wait for data to send upon polling requests.
getKeepaliveInterval
Number 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.
Returns:
The time, expressed in milliseconds, between two keepalive packets sent by the Server. If the method is called before a connection to Lightstreamer Server has been established, it returns the time that is being requested to the Server. Then, if it is called after the connection has been established, it returns the time used by the Server, that may be different, because of Server side limits.
getMaxBandwidth
Number getMaxBandwidth()
Inquiry method that gets the maximum bandwidth that can be consumed
for the data coming from Lightstreamer Server. The real bandwidth
limit applied to the connection, however, may be smaller, because of
server side restrictions.
Returns:
The maximum bandwidth requested for the streaming or polling connection, expressed in kbps (kilobits/sec), or the string "unlimited", to mean that the maximum bandwidth is decided on the Server side.
getPollingInterval
Number getPollingInterval()
Inquiry method that gets the polling interval used for polling
connections.
Returns:
The time (in milliseconds) between subsequent polling requests. If the method is called before any polling request to Lightstreamer Server has been issued, it returns the time that is being requested to the Server. Then, if it is called after the first polling request has been fulfilled, it returns the time that is really left between subsequent polling requests, that may be different, because of Server side limits.
getTimeoutForReconnect
Number getTimeoutForReconnect()
Inquiry method that gets the time the client Engine, 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.
Returns:
The idle time (in milliseconds) admitted in "STALLED" Engine status before trying to reconnect to the Server.
getTimeoutForStalled
Number getTimeoutForStalled()
Inquiry method that gets the extra time the client Engine 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.
Returns:
The idle time (in milliseconds) admitted before entering the "STALLED" Engine status.
setBufferedStreamingHandled
void setBufferedStreamingHandled()
Deprecated This method has now no effects on the behavior of the library.
setIdleTimeout
void setIdleTimeout(<Number> 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. Setting this time to a nonzero value and
the polling interval to zero leads to an "asynchronous polling"
behaviour, which, on low data rates, is very similar to the streaming
case. Setting this time to zero and the polling interval to a nonzero
value, on the other hand, leads to a classical "synchronous polling".
Note that the Server may, in some cases, delay the answer for more
than the supplied time, to protect itself against a high polling rate or
because of bandwidth restrictions. Also, the Server may impose an upper
limit on the wait time, in order to be able to check for client-side
connection drops.
Default value: 30000 (30 seconds)
Lifecycle: The wait time on polling requests can be set
and changed at any time.
Parameters:
idleTimeout
- The time (in milliseconds) the Server is allowed to wait for data to send upon polling requests.
setKeepaliveInterval
void setKeepaliveInterval(<Number> 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. The Server may, however, impose
a lower limit on the keepalive interval, in order to protect itself.
Also, the Server may impose an upper limit on the keepalive interval,
in order to be able to check for client-side connection drops.
Default value: If no value is supplied, the Server will send
keepalive packets based on its own configuration.
Lifecycle: The keepalive interval should be set on the
LightstreamerEngine.policy object before changing the
status to "STREAMING" or "POLLING". However, the value can be changed
at any time, provided that the Engine status is "DISCONNECTED"; the
supplied value will be used for the next connection attempt.
Note that, after a connection,
the value may be changed to the one imposed by the Server.
Parameters:
keepaliveInterval
- The time, expressed in milliseconds, between two keepalive packets.
setMaxBandwidth
void setMaxBandwidth(<Number> maxBandwidth)
Setter method that sets the maximum bandwidth that can be consumed
for the data coming from Lightstreamer Server. A limit on bandwidth
may already be posed by the Metadata Adapter, but the client can
furtherly restrict this limit. The limit applies to the bytes received
in each streaming or polling connection.
Edition Note: The request is ignored by the Server if it runs in Allegro
edition (i.e. "unlimited" is assumed).
Edition Note: The request is ignored by the Server if it runs in Moderato
edition (i.e. "unlimited" is assumed).
Default value: "unlimited".
Lifecycle: The bandwidth limit can be set and changed
at any time. If a connection is currently active, the bandwith limit
for the connection is changed on the fly.
Parameters:
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).
setPollingInterval
void setPollingInterval(<Number> pollingInterval)
Setter method that sets the polling interval used for polling
connections. The client Engine switches from the default streaming mode
to polling mode when the client network infrastructure does not allow
streaming on HTTP connections. Also, polling mode can be forced
by calling LightstreamerEngine.changeStatus() with “POLLING”
as parameter.
The polling interval affects the rate at which polling requests
are issued. It is the time between the start of a polling request and
the start of the next request. However, if the polling interval expires
before the first polling request has returned, then the second polling
request is delayed. This may happen, for instance, when the Server
delays the answer because of the idle timeout setting.
In any case, the polling interval allows for setting an upper limit
on the polling frequency.
The Server does not impose a lower limit on the client polling
interval.
However, in some cases, it may protect itself against a high polling
rate by delaying its answer. Network limitations and configured
bandwidth limits may also lower the polling rate, despite of the
client polling interval.
The Server may, however, impose an upper limit on the polling
interval, in order to be able to promptly detect terminated polling
request sequences and discard related session informations.
Default value: 0 (pure "asynchronous polling" is configured)
Lifecycle: The polling interval can be set and changed
at any time. Note that, after each polling request, the value may be
changed to the one imposed by the Server.
Parameters:
pollingInterval
- The time (in milliseconds) between subsequent polling requests. Zero is a legal value too, meaning that the client Engine will issue a new polling request as soon as a previous one has returned.
setSlowingEnabled
void setSlowingEnabled(<boolean> slowingEnabled)
Setter method that turns on or off the slowing algorithm. This heuristic
algorithm tries to detect when the client CPU is not able to keep the pace
of the events sent by the Server on a streaming connection. In that case,
the session is interrupted and an automatic transition to polling is
performed.
In polling, the client handles all the data before issuing the
next poll, hence a slow client would just delay the polls, while the Server
accumulates and merges the events and ensures that no obsolete data is sent.
Only in very slow clients, the next polling request may be so much
delayed that the Server disposes the session first, because of its protection
timeouts. In this case, a request for a fresh session will be reissued
by the client and this may happen in cycle.
Lifecycle: The algorithm should be enabled/disabled before changing the
status to "STREAMING". However, the value can be changed
at any time, provided that the Engine status is "DISCONNECTED"; the
supplied setting will be used for the next connection attempt.
Parameters:
slowingEnabled
- true or false, to enable or disable the heuristic algorithm that lowers the item update frequency.
setTimeoutForReconnect
void setTimeoutForReconnect(<Number> timeoutForReconnect)
Setter method that sets the time the client Engine, 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.
Default value: 3000 (3 seconds)
Lifecycle: This value can be set and changed at any time.
Parameters:
timeoutForReconnect
- The idle time (in milliseconds) allowed in "STALLED" Engine status before trying to reconnect to the Server.
setTimeoutForStalled
void setTimeoutForStalled(<Number> timeoutForStalled)
Setter method that sets the extra time the client Engine 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.
Default value: 2000 (2 seconds)
Lifecycle: This value can be set and changed at any time.
Parameters:
timeoutForStalled
- The idle time (in milliseconds) allowed before entering the "STALLED" Engine status.
Lightstreamer HTML Client API
Documentation generated by
JSDoc on Tue May 22 11:46:54 2012