Package | com.lightstreamer.as_client |
Class | public class LSClient |
Inheritance | LSClient flash.events.EventDispatcher |
Method | Defined By | ||
---|---|---|---|
LSClient()
Constructor for LSClient. | LSClient | ||
closeConnection():void
Close the connection to the Server, if a connection exists.
It is adviced to always call this method during the unload of the
Flex application. | LSClient | ||
getStatus():String
Inquiry method to know the current Client status. | LSClient | ||
Open a stream connection to the Server with the supplied parameters and policies. | LSClient | ||
Open a poll connection to the Server with the supplied parameters and policies. | LSClient | ||
sendMessage(message:*):*
Send a message to Lightstreamer Server. | LSClient | ||
setMaxBandwidth(bandwidth:*):void
Request a new maximum bandwidth for the next/current connection. | LSClient | ||
subscribeTable(table:Table):void
Subscribe to a table on the Server. | LSClient | ||
unsubscribeTable(table:Table):void
Unsubscribe from a table previously subscribed to. | LSClient |
Event | Summary | Defined By | ||
---|---|---|---|---|
Notification that a Connection is closed because of a Server decision. | LSClient | |||
Notification of an error on the control connection. | LSClient | |||
Notification of an error while receiving updates from the Server. | LSClient | |||
Notification that the outcome of a sent message will not be received. | LSClient | |||
Notification of a Server error in response to a sent message. | LSClient | |||
Notification of the successful processing of a sent message. | LSClient | |||
Notification of a Server error in response to a stream/poll request. | LSClient | |||
Notification of connection status change. | LSClient |
Constant | Defined By | ||
---|---|---|---|
COMMAND : String = COMMAND [static]
String constant for the COMMAND subscription mode to be used with Table instances. | LSClient | ||
CONNECTING : String = CONNECTING [static]
String constant for the CONNECTING status of LSClient: The Client is trying to reach Lightstreamer Server. | LSClient | ||
DISCONNECTED : String = DISCONNECTED [static]
String constant for the DISCONNECTED status of LSClient: The Client is waiting for connection commands. | LSClient | ||
DISTINCT : String = DISTINCT [static]
String constant for the DISTINCT subscription mode to be used with Table instances. | LSClient | ||
MERGE : String = MERGE [static]
String constant for the MERGE subscription mode to be used with Table instances. | LSClient | ||
POLLING : String = POLLING [static]
String constant for the POLLING status of LSClient. | LSClient | ||
RAW : String = RAW [static]
String constant for the RAW subscription mode to be used with Table instances. | LSClient | ||
STALLED : String = STALLED [static]
String constant for the STALLED status of LSClient: The Client was receiving data from
a Lightstreamer Server but the data flow now appears interrupted. | LSClient | ||
STREAMING : String = STREAMING [static]
String constant for the STREAMING status of LSClient. | LSClient |
LSClient | () | Constructor |
public function LSClient()
Constructor for LSClient. Empty constructor.
closeConnection | () | method |
public function closeConnection():void
Close the connection to the Server, if a connection exists.
It is adviced to always call this method during the unload of the Flex application. Application code should capture the unload notification in whichever way the Flex environment provides, then call closeConnection.
For instance, the Javascript unload event on the container DOM element could be captured and closeConnection could be called via the Actionscript ExternalInterface class. Moreover on Internet Explorer it is sometimes necessary to give the application some extra time between the unload event and the closure of the application, to let the Flash Player close the socket. The Flex StockList Demo client example included in the SDK shows this technique.
The newer AjaxBridge component, if available, can be used in place of the ExternalInterface class to access the LSClient from Javascript code on the container DOM element.
See also
getStatus | () | method |
public function getStatus():String
Inquiry method to know the current Client status.
ReturnsString — The current Client status.
|
See also
openConnection | () | method |
public function openConnection(info:ConnectionInfo, policy:ConnectionPolicy = null):void
Open a stream connection to the Server with the supplied parameters and policies. If a connection is already open, it is closed first.
The Stream-sense feature is enabled. If the network infrastructure blocks streaming mode, then the Client will switch to polling mode. If, however, an answer is finally received from the streaming connection after the polling connection has already been started, then the streaming connection can be recovered, depending on the setBufferedStreamingHandled setting on the "policy" argument.
In case of connection refusal by the Server, the issue is notified through a ServerErrorEvent.
Upon unload of the Flex application, an open connection should always be closed through closeConnection.
Edition Note: Connections from the Flex Client Library are not supported by the Server, if it runs in Allegro edition.
Edition Note: Connections from the Flex Client Library are not supported by the Server, if it runs in Moderato edition.
Parameters
info:ConnectionInfo — The connection parameters.
| |
policy:ConnectionPolicy (default = null ) — The connection policies. If not specified, default policies will apply.
|
See also
openPollingConnection | () | method |
public function openPollingConnection(info:ConnectionInfo, policy:ConnectionPolicy = null):void
Open a poll connection to the Server with the supplied parameters and policies. If a connection is already open, it is closed first. The Stream-sense feature is disabled (i.e. only poll connections will be used until a call to openConnection is issued).
In case of connection refusal by the Server, the issue is notified through a ServerErrorEvent.
Upon unload of the Flex application, an open connection should always be closed through closeConnection.
Edition Note: Connections from the Flex Client Library are not supported by the Server, if it runs in Allegro edition.
Edition Note: Connections from the Flex Client Library are not supported by the Server, if it runs in Moderato edition.
Parameters
info:ConnectionInfo — The connection parameters.
| |
policy:ConnectionPolicy (default = null ) — The connection policies. If not specified default policies will apply.
|
See also
sendMessage | () | method |
public function sendMessage(message:*):*
Send a message to Lightstreamer Server. The message is associated to the current session and is interpreted and managed by the Metadata Adapter related to that session.
Upon subsequent calls to the method, the sequential management of the messages is guaranteed. However, any message that, for any reason, doesn't reach the Server can be discarded by the Server if this causes the subsequent message to be kept waiting for longer than a configurable timeout. A shorter timeout can be associated with the subsequent message itself. A sequence identifier can also be associated with the messages. In this case, the sequential management is restricted to all subsets of messages with the same sequence identifier associated. In case the sequential management is undesired, the special UNORDERED_MESSAGES sequence identifier can be used.
Note that messages are sent to the Server asynchronously with respect to the Client thread and that the real outcome of the request should be obtained by listening for SendMessagevent events. Unless the return value is false, one of those events will be eventually sent. Events associated with the same sequence are guaranteed to be issued in sequence.
Parameters
message:* — A Message instance or a text String to be interpreted by the Metadata Adapter.
It should not be null.
If a text String is supplied, a sequence identifier made by an empty string will be considered, hence all messages sent with this syntax belong to the same sequence. |
* — false if no session is open; in the other case, if a String was given, true is returned
(this is for backward compatibility);
otherwise, if a Message instance was given, a number representing the progressive number of the
message within its sequence is returned (starting from 1). Note that each time a new session is established
the progressive number is reset.
Note that if no session is open, no attempt of sending the message will be performed; however, as messages are sent to the Server asynchronously, if a session is open but ends before the message is sent, then no attempt of sending the message will be performed either, but a SendMessageAbortEvent event will be sent. |
ConfigurationError — An invalid object was specified as message.
|
See also
setMaxBandwidth | () | method |
public function setMaxBandwidth(bandwidth:*):void
Request a new maximum bandwidth for the next/current connection. The new limit overrides any previous limit. The limit can only be used in order to restrict the constraints set by Lightstreamer Server Metadata Adapter.
Parameters
bandwidth:* — The maximum bandwidth requested for the stream or poll 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. Default value is "unlimited".
|
ConfigurationError — An invalid value was specified.
|
subscribeTable | () | method |
public function subscribeTable(table:Table):void
Subscribe to a table on the Server.
Parameters
table:Table — The table object to be subscribed to.
|
SubscriptionError — The table is already subscribed.
|
See also
unsubscribeTable | () | method |
public function unsubscribeTable(table:Table):void
Unsubscribe from a table previously subscribed to.
Parameters
table:Table — The table to be unsubscribed from.
|
SubscriptionError — The table is not subscribed.
|
ConnectionDropEvent | Event |
com.lightstreamer.as_client.events.ConnectionDropEvent
com.lightstreamer.as_client.events.ConnectionDropEvent.CONNECTION_DROP
Notification that a Connection is closed because of a Server decision.
Define the value of the type property of a ConnectionDrop event object.ControlConnectionErrorEvent | Event |
com.lightstreamer.as_client.events.ControlConnectionErrorEvent
com.lightstreamer.as_client.events.ControlConnectionErrorEvent.CONTROL_CONNECTION_ERROR
Notification of an error on the control connection.
Define the value of the type property of a ControlConnectionError event object.DataErrorEvent | Event |
com.lightstreamer.as_client.events.DataErrorEvent
com.lightstreamer.as_client.events.DataErrorEvent.DATA_ERROR
Notification of an error while receiving updates from the Server.
Define the value of the type property of a DataErrorEvent event object.SendMessageAbortEvent | Event |
com.lightstreamer.as_client.events.SendMessageAbortEvent
com.lightstreamer.as_client.events.SendMessageAbortEvent.SEND_MESSAGE_ABORT
Notification that the outcome of a sent message will not be received.
Define the value of the type property of a SendMessageAbort event object.SendMessageErrorEvent | Event |
com.lightstreamer.as_client.events.SendMessageErrorEvent
com.lightstreamer.as_client.events.SendMessageErrorEvent.SEND_MESSAGE_ERROR
Notification of a Server error in response to a sent message.
Define the value of the type property of a SendMessageError event object.SendMessageProcessedEvent | Event |
com.lightstreamer.as_client.events.SendMessageProcessedEvent
com.lightstreamer.as_client.events.SendMessageProcessedEvent.SEND_MESSAGE_PROCESSED
Notification of the successful processing of a sent message.
Define the value of the type property of a SendMessageProcessed event object.ServerErrorEvent | Event |
com.lightstreamer.as_client.events.ServerErrorEvent
com.lightstreamer.as_client.events.ServerErrorEvent.SERVER_ERROR
Notification of a Server error in response to a stream/poll request.
Define the value of the type property of a ControlError event object.StatusChangeEvent | Event |
com.lightstreamer.as_client.events.StatusChangeEvent
com.lightstreamer.as_client.events.StatusChangeEvent.STATUS_CHANGE
Notification of connection status change.
Define the value of the type property of a StatusChange event object.COMMAND | Constant |
public static const COMMAND:String = COMMAND
String constant for the COMMAND subscription mode to be used with Table instances.
CONNECTING | Constant |
public static const CONNECTING:String = CONNECTING
String constant for the CONNECTING status of LSClient: The Client is trying to reach Lightstreamer Server.
DISCONNECTED | Constant |
public static const DISCONNECTED:String = DISCONNECTED
String constant for the DISCONNECTED status of LSClient: The Client is waiting for connection commands.
DISTINCT | Constant |
public static const DISTINCT:String = DISTINCT
String constant for the DISTINCT subscription mode to be used with Table instances.
MERGE | Constant |
public static const MERGE:String = MERGE
String constant for the MERGE subscription mode to be used with Table instances.
POLLING | Constant |
public static const POLLING:String = POLLING
String constant for the POLLING status of LSClient. The Client is receiving real-time updates from Lightstreamer Server in polling mode.
RAW | Constant |
public static const RAW:String = RAW
String constant for the RAW subscription mode to be used with Table instances.
STALLED | Constant |
public static const STALLED:String = STALLED
String constant for the STALLED status of LSClient: The Client was receiving data from a Lightstreamer Server but the data flow now appears interrupted.
STREAMING | Constant |
public static const STREAMING:String = STREAMING
String constant for the STREAMING status of LSClient. The Client is receiving real-time updates from Lightstreamer Server in streaming mode.