| 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.
| 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:String):Boolean
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 of an error on the control connection. | LSClient | |||
| Notification of a Server error in response to a control request. | LSClient | |||
| Notification of a Server error in response to a stream/poll request. | LSClient | |||
| Notification of connection status change. | LSClient | |||
| Constant | Defined by | ||
|---|---|---|---|
| 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 | ||
| POLLING : String = "POLLING" [static]
String constant for the "POLLING" status of LSClient.
| 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():StringInquiry 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.
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.
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).
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.
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:String):BooleanSend 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.
Parametersmessage:String — Any text string, to be interpreted by the Metadata Adapter. It should not be null.
|
Boolean — true if a session is open; false in the other case. Note that messages to the Server are sent
asynchronously with respect to the Client thread. If the server session ends before the message is sent,
then that message will never reach the Server.
|
| setMaxBandwidth | () | method |
public function setMaxBandwidth(bandwidth:*):voidRequest 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.
Parametersbandwidth:* — 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):voidSubscribe to a table on the Server.
Parameterstable:Table — The table object to be subscribed to.
|
SubscriptionError — The table is already subscribed.
|
See also
| unsubscribeTable | () | method |
public function unsubscribeTable(table:Table):voidUnsubscribe from a table previously subscribed to.
Parameterstable:Table — The table to be unsubscribed from.
|
SubscriptionError — The table is not subscribed.
|
| ControlConnectionErrorEvent | event |
com.lightstreamer.as_client.events.ControlConnectionErrorEvent
Notification of an error on the control connection.
| ControlErrorEvent | event |
com.lightstreamer.as_client.events.ControlErrorEvent
Notification of a Server error in response to a control request.
| ServerErrorEvent | event |
com.lightstreamer.as_client.events.ServerErrorEvent
Notification of a Server error in response to a stream/poll request.
| StatusChangeEvent | event |
com.lightstreamer.as_client.events.StatusChangeEvent
Notification of connection status change.
| 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.
| 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.
| 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.