LightstreamerClient class
Facade class for the management of the communication to Lightstreamer Server.
Used to provide configuration settings, event
handlers, operations for the control of the connection lifecycle,
Subscription handling and to send messages.
It also provides support for mobile push notifications (MPN) via
MpnSubscription, a specific kind of subscription that
routes real-time updates via push notifications.
An instance of LightstreamerClient handles the communication with
Lightstreamer Server on a specified endpoint. Hence, it hosts one "Session";
or, more precisely, a sequence of Sessions, since any Session may fail
and be recovered, or it can be interrupted on purpose.
So, normally, a single instance of LightstreamerClient is needed.
However, multiple instances of LightstreamerClient can be used,
toward the same or multiple endpoints.
You can listen to the events generated by a session by registering an event listener, such as ClientListener or SubscriptionListener. These listeners allow you to handle various events, such as session creation, connection status, subscription updates, and server messages. However, you should be aware that the event notifications are dispatched by a single thread, the so-called event thread. This means that if the operations of a listener are slow or blocking, they will delay the processing of the other listeners and affect the performance of your application. Therefore, you should delegate any slow or blocking operations to a dedicated thread, and keep the listener methods as fast and simple as possible. Note that even if you create multiple instances of LightstreamerClient, they will all use a single event thread, that is shared among them.
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
- LightstreamerClient(String serverAddress, String adapterSet)
-
Creates an object to be configured to connect to a Lightstreamer server
and to handle all the communications with it.
factory
Properties
- connectionDetails → ConnectionDetails
-
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Data object that contains the details needed to open a connection to a Lightstreamer Server.no setter - connectionOptions → ConnectionOptions
-
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Data object that contains options and policies for the connection to the server.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
ClientListener listener) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Adds a listener that will receive events from the LightstreamerClient instance. -
connect(
) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that requests to open a Session against the configured Lightstreamer Server. -
disconnect(
) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that requests to close the Session opened against the configured Lightstreamer Server (if any). -
findMpnSubscription(
String subscriptionId) → MpnSubscription? -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
-
getListeners(
) → List< ClientListener> -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Returns a list containing the ClientListener instances that were added to this client. -
getMpnSubscriptions(
String? filter) → List< MpnSubscription> -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Inquiry method that returns a collection of the existing MPN subscription with a specified status. -
getStatus(
) → String -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Inquiry method that gets the current client status and transport (when applicable). -
getSubscriptions(
) → List< Subscription> -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Inquiry method that returns a list containing all the Subscription instances that are currently "active" on this LightstreamerClient. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerForMpn(
MpnDevice device) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that registers the MPN device on the server's MPN Module. -
removeListener(
ClientListener listener) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Removes a listener from the LightstreamerClient instance so that it will not receive events anymore. -
sendMessage(
String message, [String? sequence, int? delayTimeout, ClientMessageListener? listener, bool? enqueueWhileDisconnected]) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that sends a message to the Server. -
subscribe(
Subscription sub) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that adds a Subscription to the list of "active" Subscriptions. The Subscription cannot already be in the "active" state. -
subscribeMpn(
MpnSubscription subscription, bool coalescing) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that subscribes an MpnSubscription on server's MPN Module. -
toString(
) → String -
A string representation of this object.
inherited
-
unsubscribe(
Subscription sub) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that removes a Subscription that is currently in the "active" state. -
unsubscribeMpn(
MpnSubscription sub) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that unsubscribes an MpnSubscription from the server's MPN Module. -
unsubscribeMpnSubscriptions(
String? filter) → void -
Available on LightstreamerClient, provided by the LightstreamerClientExt extension
Operation method that unsubscribes all the MPN subscriptions with a specified status from the server's MPN Module.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
setLoggerProvider(
LoggerProvider provider) → void - Static method that permits to configure the logging system used by the library.