Packagecom.lightstreamer.as_client
Classpublic class ConnectionPolicy
InheritanceConnectionPolicy Inheritance Object

ConnectionPolicy collects the timeouts used for the connections to Lightstreamer Server..



Public Properties
 PropertyDefined By
  bufferedStreamingHandled : Boolean
Indicates whether or not to enable the recovery mechanism for streaming connections that appear to be buffered (Default value is false). When the network infrastructure buffers the initial part of the streaming data flow, the Client automatically switches to smart polling mode.
ConnectionPolicy
  connectionTimeout : uint
The timeout (in milliseconds) that is applied on any attempt to setup a streaming connection (Default value is 5000).
ConnectionPolicy
  idleTimeout : uint
The maximum time (in milliseconds) the Server is allowed to wait for any data to be sent in response to a polling request, if no data is available at request time (default is 30000). Setting this time to a non-zero value and the polling interval to zero leads to an "asynchronous polling" behaviour, which, on low data rates, is very similar to the streaming mode. Setting this time to zero and the polling interval to a nonzero value, on the other hand, leads to a classical "synchronous polling".
ConnectionPolicy
  requestedKeepaliveInterval : uint
The interval (in milliseconds) between two keepalive packets (heartbeats) 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.
ConnectionPolicy
  requestedPollingInterval : uint
The time (in milliseconds) between subsequent polling requests.
ConnectionPolicy
  retryTimeout : uint
The time (in milliseconds) the library has to wait, after an unsuccessful streaming or polling connection attempt, before automatically performing a new attempt (default is 5000).
ConnectionPolicy
  timeoutForReconnect : uint
The time (in milliseconds) 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 is 3000).
ConnectionPolicy
  timeoutForStalled : uint
The extra time (in milliseconds) 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 is 2000).
ConnectionPolicy
Public Methods
 MethodDefined By
  
Create an object that encapsulates the timeout settings, with default values.
ConnectionPolicy
  
Provides the time between two keepalive packets sent by the Server.
ConnectionPolicy
  
Provides the time between subsequent polling requests allowed by the Server.
ConnectionPolicy
Property Detail
bufferedStreamingHandledproperty
bufferedStreamingHandled:Boolean

Indicates whether or not to enable the recovery mechanism for streaming connections that appear to be buffered (Default value is false).

When the network infrastructure buffers the initial part of the streaming data flow, the Client automatically switches to smart polling mode. Setting this property to true enables the Client to switch-back to streaming mode if the network infrastructure releases the data after the initial buffering.

This recovery mechanism is one of the features of the "Stream-sense" mechanism. It allows a better quality communication channel to be finally established in many cases. But if some intermediate proxy or antivirus buffers the streaming data flow in blocks (that is, not only on the initial part), then the streaming recovery may lead to a worse communication channel, with pauses that may even cause the client Engine to enter the STALLED status.


Implementation
    public function get bufferedStreamingHandled():Boolean
    public function set bufferedStreamingHandled(value:Boolean):void

See also

connectionTimeoutproperty 
connectionTimeout:uint

The timeout (in milliseconds) that is applied on any attempt to setup a streaming connection (Default value is 5000). If after the timeout no data has arrived on the stream connection and if "bufferedStreamingHandled" is true, such connection may be kept open in the background until a proper timeout has passed. In any case, after the timeout, a polling connection is attempted.


Implementation
    public function get connectionTimeout():uint
    public function set connectionTimeout(value:uint):void

Throws
ConfigurationError — An invalid number is being set.

See also

idleTimeoutproperty 
idleTimeout:uint

The maximum time (in milliseconds) the Server is allowed to wait for any data to be sent in response to a polling request, if no data is available at request time (default is 30000).

Setting this time to a non-zero value and the polling interval to zero leads to an "asynchronous polling" behaviour, which, on low data rates, is very similar to the streaming mode.

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.


Implementation
    public function get idleTimeout():uint
    public function set idleTimeout(value:uint):void

Throws
ConfigurationError — An invalid number is being set.

See also

requestedKeepaliveIntervalproperty 
requestedKeepaliveInterval:uint

The interval (in milliseconds) between two keepalive packets (heartbeats) 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.

If no value is supplied, the Server will send keepalive packets based on its own configuration.


Implementation
    public function get requestedKeepaliveInterval():uint
    public function set requestedKeepaliveInterval(value:uint):void

Throws
ConfigurationError — An invalid number is being set.

See also

requestedPollingIntervalproperty 
requestedPollingInterval:uint

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 (default is 0).

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 the openPollingConnection method of the LSClient class.

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 also impose an upper limit on the polling interval, in order to be able to promptly detect terminated polling request sequences and discard related session information.


Implementation
    public function get requestedPollingInterval():uint
    public function set requestedPollingInterval(value:uint):void

Throws
ConfigurationError — An invalid number is being set.

See also

retryTimeoutproperty 
retryTimeout:uint

The time (in milliseconds) the library has to wait, after an unsuccessful streaming or polling connection attempt, before automatically performing a new attempt (default is 5000).


Implementation
    public function get retryTimeout():uint
    public function set retryTimeout(value:uint):void

Throws
ConfigurationError — An invalid number is being set.
timeoutForReconnectproperty 
timeoutForReconnect:uint

The time (in milliseconds) 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 is 3000).


Implementation
    public function get timeoutForReconnect():uint
    public function set timeoutForReconnect(value:uint):void

Throws
ConfigurationError — An invalid number is being set.

See also

timeoutForStalledproperty 
timeoutForStalled:uint

The extra time (in milliseconds) 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 is 2000).


Implementation
    public function get timeoutForStalled():uint
    public function set timeoutForStalled(value:uint):void

Throws
ConfigurationError — An invalid number is being set.

See also

Constructor Detail
ConnectionPolicy()Constructor
public function ConnectionPolicy()

Create an object that encapsulates the timeout settings, with default values.

Method Detail
getServerKeepaliveInterval()method
public function getServerKeepaliveInterval():uint

Provides the time 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.

Returns
uint — A time in milliseconds.

See also

getServerPollingInterval()method 
public function getServerPollingInterval():uint

Provides the time between subsequent polling requests allowed by the Server. 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.

Returns
uint — A time in milliseconds.

See also