/** * This is a dummy constructor not to be used in any case. */ export class Logger { constructor(); /** * Receives log messages at FATAL level. * @param message - The message to be logged. * @param [exception] - An Exception instance related to the current log message. */ fatal(message: string, exception?: Error): void; /** * Checks if this Logger is enabled for the FATAL level. * The method should return true if this Logger is enabled for FATAL events, * false otherwise. *
This property is intended to let the library save computational cost by suppressing the generation of * log FATAL statements. However, even if the method returns false, FATAL log * lines may still be received by the {@link Logger#fatal} method * and should be ignored by the Logger implementation. * @returns true if FATAL logging is enabled, false otherwise */ isFatalEnabled(): boolean; /** * Receives log messages at ERROR level. * @param message - The message to be logged. * @param [exception] - An Exception instance related to the current log message. */ error(message: string, exception?: Error): void; /** * Checks if this Logger is enabled for the ERROR level. * The method should return true if this Logger is enabled for ERROR events, * false otherwise. *
This property is intended to let the library save computational cost by suppressing the generation of * log ERROR statements. However, even if the method returns false, ERROR log * lines may still be received by the {@link Logger#error} method * and should be ignored by the Logger implementation. * @returns true if ERROR logging is enabled, false otherwise */ isErrorEnabled(): boolean; /** * Receives log messages at WARN level. * @param message - The message to be logged. * @param [exception] - An Exception instance related to the current log message. */ warn(message: string, exception?: Error): void; /** * Checks if this Logger is enabled for the WARN level. * The method should return true if this Logger is enabled for WARN events, * false otherwise. *
This property is intended to let the library save computational cost by suppressing the generation of * log WARN statements. However, even if the method returns false, WARN log * lines may still be received by the {@link Logger#warn} method * and should be ignored by the Logger implementation. * @returns true if WARN logging is enabled, false otherwise */ isWarnEnabled(): boolean; /** * Receives log messages at INFO level. * @param message - The message to be logged. * @param [exception] - An Exception instance related to the current log message. */ info(message: string, exception?: Error): void; /** * Checks if this Logger is enabled for the INFO level. * The method should return true if this Logger is enabled for INFO events, * false otherwise. *
This property is intended to let the library save computational cost by suppressing the generation of * log INFO statements. However, even if the method returns false, INFO log * lines may still be received by the {@link Logger#info} method * and should be ignored by the Logger implementation. * @returns true if INFO logging is enabled, false otherwise */ isInfoEnabled(): boolean; /** * Receives log messages at DEBUG level. * @param message - The message to be logged. * @param [exception] - An Exception instance related to the current log message. */ debug(message: string, exception?: Error): void; /** * Checks if this Logger is enabled for the DEBUG level. * The method should return true if this Logger is enabled for DEBUG events, * false otherwise. *
This property is intended to let the library save computational cost by suppressing the generation of * log DEBUG statements. However, even if the method returns false, DEBUG log * lines may still be received by the {@link Logger#debug} method * and should be ignored by the Logger implementation. * @returns true if DEBUG logging is enabled, false otherwise */ isDebugEnabled(): boolean; /** * Receives log messages at TRACE level. * @param message - The message to be logged. * @param [exception] - An Exception instance related to the current log message. */ trace(message: string, exception?: Error): void; /** * Checks if this Logger is enabled for the TRACE level. * The method should return true if this Logger is enabled for TRACE events, * false otherwise. *
This property is intended to let the library save computational cost by suppressing the generation of * log TRACE statements. However, even if the method returns false, TRACE log * lines may still be received by the {@link Logger#trace} method * and should be ignored by the Logger implementation. * @returns true if TRACE logging is enabled, false otherwise */ isTraceEnabled(): boolean; } /** * This is a dummy constructor not to be used in any case. */ export class LoggerProvider { constructor(); /** * Invoked to request a {@link Logger} instance that will be used for logging occurring * on the given category. It is suggested, but not mandatory, that subsequent * calls to this method related to the same category return the same {@link Logger} * instance. * @param category - the log category all messages passed to the given * Logger instance will pertain to. * @returns A Logger instance that will receive log lines related to * the given category. */ getLogger(category: string): Logger; } /** * This is a dummy constructor not to be used in any case. */ export class ClientListener { constructor(); /** * Event handler that is called when the Server notifies a refusal on the * client attempt to open a new connection or the interruption of a * streaming connection. In both cases, the {@link ClientListener#onStatusChange} * event handler has already been invoked with a "DISCONNECTED" status and * no recovery attempt has been performed. By setting a custom handler, however, * it is possible to override this and perform custom recovery actions. * @param errorCode - The error code. It can be one of the * following: * * @param errorMessage - The description of the error as sent * by the Server. */ onServerError?(errorCode: number, errorMessage: string): void; /** * Event handler that receives a notification each time the LightstreamerClient * status has changed. The status changes may be originated either by custom * actions (e.g. by calling {@link LightstreamerClient#disconnect}) or by * internal actions. *

The normal cases are the following: * *
Possible special cases are the following: * * *
By setting a custom handler it is possible to perform * actions related to connection and disconnection occurrences. Note that * {@link LightstreamerClient#connect} and {@link LightstreamerClient#disconnect}, * as any other method, can be issued directly from within a handler. * @param chngStatus - The new status. It can be one of the * following values: * */ onStatusChange?(chngStatus: string): void; /** * Event handler that receives a notification each time the value of a property of * {@link LightstreamerClient#connectionDetails} or {@link LightstreamerClient#connectionOptions} * is changed. * @param the - name of the changed property. *
Possible values are: * */ onPropertyChange?(the: string): void; /** * Event handler that receives a notification when the ClientListener instance * is added to a LightstreamerClient through * {@link LightstreamerClient#addListener}. * This is the first event to be fired on the listener. */ onListenStart?(): void; /** * Event handler that receives a notification when the ClientListener instance * is removed from a LightstreamerClient through * {@link LightstreamerClient#removeListener}. * This is the last event to be fired on the listener. */ onListenEnd?(): void; /** * Notifies that the Server has sent a keepalive message because a streaming connection * is in place and no update had been sent for the configured time * (see {@link ConnectionOptions#setKeepaliveInterval}). * However, note that the lack of both updates and keepalives is already managed by the library * (see {@link ConnectionOptions#setReconnectTimeout} and {@link ConnectionOptions#setStalledTimeout}). */ onServerKeepalive?(): void; } /** * This is a dummy constructor not to be used in any case. */ export class ClientMessageListener { constructor(); /** * Event handler that is called by Lightstreamer when any notifications * of the processing outcome of the related message haven't been received * yet and can no longer be received. * Typically, this happens after the session has been closed. * In this case, the client has no way of knowing the processing outcome * and any outcome is possible. * @param originalMessage - the message to which this notification * is related. * @param sentOnNetwork - true if the message was probably sent on the * network, false otherwise. *
Event if the flag is true, it is not possible to infer whether the message * actually reached the Lightstreamer Server or not. */ onAbort?(originalMessage: string, sentOnNetwork: boolean): void; /** * Event handler that is called by Lightstreamer when the related message * has been processed by the Server but the processing has failed for any * reason. The level of completion of the processing by the Metadata Adapter * cannot be determined. * @param originalMessage - the message to which this notification * is related. */ onError?(originalMessage: string): void; /** * Event handler that is called by Lightstreamer to notify that the related * message has been discarded by the Server. This means that the message * has not reached the Metadata Adapter and the message next in the sequence * is considered enabled for processing. * @param originalMessage - the message to which this notification * is related. */ onDiscarded?(originalMessage: string): void; /** * Event handler that is called by Lightstreamer when the related message * has been processed by the Server but the expected processing outcome * could not be achieved for any reason. * @param originalMessage - the message to which this notification * is related. * @param code - the error code sent by the Server. It can be one * of the following: * * @param message - the description of the error sent by the Server. */ onDeny?(originalMessage: string, code: number, message: string): void; /** * Event handler that is called by Lightstreamer when the related message * has been processed by the Server with success. * @param originalMessage - the message to which this notification * is related. * @param response - the response from the Metadata Adapter. If not supplied (i.e. supplied as null), an empty message is received here. */ onProcessed?(originalMessage: string, response: string): void; } /** * Used by the client library to provide a value object to each call of the * {@link SubscriptionListener#onItemUpdate} event. */ export class ItemUpdate { constructor(); /** * Inquiry method that retrieves the name of the item to which this update * pertains. *
The name will be null if the related Subscription was initialized * using an "Item Group". * @returns the name of the item to which this update pertains. */ getItemName(): string; /** * Inquiry method that retrieves the position in the "Item List" or "Item Group" * of the item to which this update pertains. * @returns the 1-based position of the item to which this update pertains. */ getItemPos(): number; /** * Inquiry method that gets the value for a specified field, as received * from the Server with the current or previous update. * @param fieldNameOrPos - The field name or the 1-based position of the field * within the "Field List" or "Field Schema". * @returns The value of the specified field; it can be null in the following * cases: * */ getValue(fieldNameOrPos: string): string; /** * Inquiry method that gets the difference between the new value and the previous one * as a JSON Patch structure, provided that the Server has used the JSON Patch format * to send this difference, as part of the "delta delivery" mechanism. * This, in turn, requires that: * Note that the last condition can be enforced by leveraging the Server's * <jsonpatch_min_length> configuration flag, so that the availability of the * JSON Patch form would only depend on the Client and the Data Adapter. *
When the above conditions are not met, the method just returns null; in this * case, the new value can only be determined through {@link ItemUpdate#getValue}. For instance, * this will always be needed to get the first value received. * @param fieldNameOrPos - The field name or the 1-based position of the field * within the "Field List" or "Field Schema". * @returns A JSON Patch structure representing the difference between * the new value and the previous one, or null if the difference in JSON Patch format * is not available for any reason. */ getValueAsJSONPatchIfAvailable(fieldNameOrPos: string): any; /** * Inquiry method that asks whether the value for a field has changed after * the reception of the last update from the Server for an item. * If the Subscription mode is COMMAND then the change is meant as * relative to the same key. * @param fieldNameOrPos - The field name or the 1-based position of the field * within the field list or field schema. * @returns Unless the Subscription mode is COMMAND, the return value is true * in the following cases: * * If the Subscription mode is COMMAND, the return value is true in the * following cases: * * In all other cases, the return value is false. */ isValueChanged(fieldNameOrPos: string): boolean; /** * Inquiry method that asks whether the current update belongs to the * item snapshot (which carries the current item state at the time of * Subscription). Snapshot events are sent only if snapshot information * was requested for the items through {@link Subscription#setRequestedSnapshot} * and precede the real time events. * Snapshot information take different forms in different subscription * modes and can be spanned across zero, one or several update events. * In particular: * * Note that, in case of two-level behavior, snapshot-related updates * for both the first-level item (which is in COMMAND mode) and any * second-level items (which are in MERGE mode) are qualified with this flag. * @returns true if the current update event belongs to the item snapshot; * false otherwise. */ isSnapshot(): boolean; /** * Receives an iterator function and invokes it once per each field such that {@link ItemUpdate#isValueChanged} is true. *
Note that if the Subscription mode of the involved Subscription is * COMMAND, then changed fields are meant as relative to the previous update * for the same key. On such tables if a DELETE command is received, all the * fields, excluding the key field, will be iterated as changed, with null value. All of this * is also true on tables that have the two-level behavior enabled, but in * case of DELETE commands second-level fields will not be iterated. *
Note that the iterator is executed before this method returns. * @param iterator - Function instance that will be called once * per each field changed on the last update received from the server. */ forEachChangedField(iterator: ItemUpdateChangedFieldCallback): void; /** * Receives an iterator function and invokes it once per each field * in the Subscription. *
Note that the iterator is executed before this method returns. * @param iterator - Function instance that will be called once * per each field in the Subscription. */ forEachField(iterator: ItemUpdateChangedFieldCallback): void; } /** * Callback for {@link ItemUpdate#forEachChangedField} and {@link ItemUpdate#forEachField} * @param fieldName - of the involved changed field. If the related Subscription was * initialized using a "Field Schema" it will be null. * @param fieldPos - 1-based position of the field within * the "Field List" or "Field Schema". * @param value - the value for the field. See {@link ItemUpdate#getValue} for details. */ declare type ItemUpdateChangedFieldCallback = (fieldName: string, fieldPos: number, value: string) => void; /** * This is a dummy constructor not to be used in any case. */ export class SubscriptionListener { constructor(); /** * Event handler that is called by Lightstreamer each time an update * pertaining to an item in the Subscription has been received from the * Server. * @param updateInfo - a value object containing the * updated values for all the fields, together with meta-information about * the update itself and some helper methods that can be used to iterate through * all or new values. */ onItemUpdate?(updateInfo: ItemUpdate): void; /** * Event handler that is called by Lightstreamer to notify that, due to * internal resource limitations, Lightstreamer Server dropped one or more * updates for an item in the Subscription. Such notifications are sent only * if the items are delivered in an unfiltered mode; this occurs if the * subscription mode is: * * By implementing this method it is possible to perform recovery actions. * @param itemName - name of the involved item. If the Subscription * was initialized using an "Item Group" then a null value is supplied. * @param itemPos - 1-based position of the item within the "Item List" * or "Item Group". * @param lostUpdates - The number of consecutive updates dropped * for the item. */ onItemLostUpdates?(itemName: string, itemPos: number, lostUpdates: number): void; /** * Event handler that is called by Lightstreamer to notify that, due to * internal resource limitations, Lightstreamer Server dropped one or more * updates for an item that was subscribed to as a second-level subscription. * Such notifications are sent only if the Subscription was configured in * unfiltered mode (second-level items are always in "MERGE" mode and * inherit the frequency configuration from the first-level Subscription). *
By implementing this method it is possible to perform recovery actions. * @param lostUpdates - The number of consecutive updates dropped * for the item. * @param key - The value of the key that identifies the * second-level item. */ onCommandSecondLevelItemLostUpdates?(lostUpdates: number, key: string): void; /** * Event handler that is called by Lightstreamer to notify that all * snapshot events for an item in the Subscription have been received, * so that real time events are now going to be received. The received * snapshot could be empty. * Such notifications are sent only if the items are delivered in * DISTINCT or COMMAND subscription mode and snapshot information was * indeed requested for the items. * By implementing this method it is possible to perform actions which * require that all the initial values have been received. *
Note that, if the involved Subscription has a two-level behavior enabled, the notification * refers to the first-level item (which is in COMMAND mode). * Snapshot-related updates for the second-level items (which are in * MERGE mode) can be received both before and after this notification. * @param itemName - name of the involved item. If the Subscription * was initialized using an "Item Group" then a null value is supplied. * @param itemPos - 1-based position of the item within the "Item List" * or "Item Group". */ onEndOfSnapshot?(itemName: string, itemPos: number): void; /** * Event handler that is called by Lightstreamer each time a request * to clear the snapshot pertaining to an item in the Subscription has been * received from the Server. * More precisely, this kind of request can occur in two cases: * *
Note that, if the involved Subscription has a two-level behavior enabled, * the notification refers to the first-level item (which is in COMMAND mode). * This kind of notification is not possible for second-level items (which are in * MERGE mode). *
This event can be sent by the Lightstreamer Server since version 6.0 * @param itemName - name of the involved item. If the Subscription * was initialized using an "Item Group" then a null value is supplied. * @param itemPos - 1-based position of the item within the "Item List" * or "Item Group". */ onClearSnapshot?(itemName: string, itemPos: number): void; /** * Event handler that is called by Lightstreamer to notify that a Subscription * has been successfully subscribed to through the Server. * This can happen multiple times in the life of a Subscription instance, * in case the Subscription is performed multiple times through * {@link LightstreamerClient#unsubscribe} and {@link LightstreamerClient#subscribe}. * This can also happen multiple times in case of automatic recovery after a connection * restart. *
This notification is always issued before the other ones related * to the same subscription. It invalidates all data that has been received * previously. *
Note that two consecutive calls to this method are not possible, as before * a second onSubscription event is fired an onUnsubscription event is eventually * fired. *
If the involved Subscription has a two-level behavior enabled, * second-level subscriptions are not notified. */ onSubscription?(): void; /** * Event handler that is called by Lightstreamer to notify that a Subscription * has been successfully unsubscribed from. * This can happen multiple times in the life of a Subscription instance, * in case the Subscription is performed multiple times through * {@link LightstreamerClient#unsubscribe} and {@link LightstreamerClient#subscribe}. * This can also happen multiple times in case of automatic recovery after a connection * restart. * *
After this notification no more events can be recieved until a new * {@link SubscriptionListener#onSubscription} event. *
Note that two consecutive calls to this method are not possible, as before * a second onUnsubscription event is fired an onSubscription event is eventually * fired. *
If the involved Subscription has a two-level behavior enabled, * second-level unsubscriptions are not notified. */ onUnsubscription?(): void; /** * Event handler that is called when the Server notifies an error on a Subscription. By implementing this method it * is possible to perform recovery actions.
* Note that, in order to perform a new subscription attempt, {@link LightstreamerClient#unsubscribe} * and {@link LightstreamerClient#subscribe} should be issued again, even if no change to the Subscription * attributes has been applied. * @param code - The error code sent by the Server. It can be one of the following: * * @param message - The description of the error sent by the Server; * it can be null. */ onSubscriptionError?(code: number, message: string): void; /** * Event handler that is called when the Server notifies an error on a second-level subscription.
* By implementing this method it is possible to perform recovery actions. * @param code - The error code sent by the Server. It can be one of the following: * * @param message - The description of the error sent by the Server; it can be null. * @param key - The value of the key that identifies the second-level item. */ onCommandSecondLevelSubscriptionError?(code: number, message: string, key: string): void; /** * Event handler that receives a notification when the SubscriptionListener instance * is added to a Subscription through * {@link Subscription#addListener}. * This is the first event to be fired on the listener. */ onListenStart?(): void; /** * Event handler that receives a notification when the SubscriptionListener instance * is removed from a Subscription through * {@link Subscription#removeListener}. * This is the last event to be fired on the listener. */ onListenEnd?(): void; /** * Event handler that is called by Lightstreamer to notify the client with the real maximum update frequency of the Subscription. * It is called immediately after the Subscription is established and in response to a requested change * (see {@link Subscription#setRequestedMaxFrequency}). * Since the frequency limit is applied on an item basis and a Subscription can involve multiple items, * this is actually the maximum frequency among all items. For Subscriptions with two-level behavior * (see {@link Subscription#setCommandSecondLevelFields} and {@link Subscription#setCommandSecondLevelFieldSchema}) * , the reported frequency limit applies to both first-level and second-level items.
* The value may differ from the requested one because of restrictions operated on the server side, * but also because of number rounding.
* Note that a maximum update frequency (that is, a non-unlimited one) may be applied by the Server * even when the subscription mode is RAW or the Subscription was done with unfiltered dispatching. * @param frequency - A decimal number, representing the maximum frequency applied by the Server * (expressed in updates per second), or the string "unlimited". A null value is possible in rare cases, * when the frequency can no longer be determined. */ onRealMaxFrequency?(frequency: string): void; } /** * This is a dummy constructor not to be used in any case. */ export class MpnDeviceListener { constructor(); /** * Event handler called when the MpnDeviceListener instance is added to an MPN device object through {@link MpnDevice#addListener}.
* This is the first event to be fired on the listener. */ onListenStart?(): void; /** * Event handler called when the MpnDeviceListener instance is removed from an MPN device object through {@link MpnDevice#removeListener}.
* This is the last event to be fired on the listener. */ onListenEnd?(): void; /** * Event handler called when an MPN device object has been successfully registered on the server's MPN Module.
* This event handler is always called before other events related to the same device.
* Note that this event can be called multiple times in the life of an MPN device object in case the client disconnects and reconnects. In this case * the device is registered again automatically. */ onRegistered?(): void; /** * Event handler called when an MPN device object has been suspended on the server's MPN Module.
* An MPN device may be suspended if errors occur during push notification delivery.
* Note that in some server clustering configurations this event may not be called. */ onSuspended?(): void; /** * Event handler called when an MPN device object has been resumed on the server's MPN Module.
* An MPN device may be resumed from suspended state at the first subsequent registration.
* Note that in some server clustering configurations this event may not be called. */ onResumed?(): void; /** * Event handler called when the server notifies that an MPN device changed its status.
* Note that in some server clustering configurations the status change for the MPN device suspend event may not be called. * @param status - The new status of the MPN device. It can be one of the following: * @param timestamp - The server-side timestamp of the new device status. */ onStatusChanged?(status: string, timestamp: number): void; /** * Event handler called when the server notifies an error while registering an MPN device object.
* By implementing this method it is possible to perform recovery actions. * @param code - The error code sent by the Server. It can be one of the following: * @param message - The description of the error sent by the Server; it can be null. */ onRegistrationFailed?(code: number, message: string): void; /** * Event handler called when the server notifies that the list of MPN subscription associated with an MPN device has been updated.
* After registration, the list of pre-existing MPN subscriptions for the MPN device is updated and made available through the * {@link LightstreamerClient#getMpnSubscriptions} method. */ onSubscriptionsUpdated?(): void; } /** * This is a dummy constructor not to be used in any case. */ export class MpnSubscriptionListener { constructor(); /** * Event handler called when the MpnSubscriptionListener instance is added to an {@link MpnSubscription} through * {@link MpnSubscription#addListener}.
* This is the first event to be fired on the listener. */ onListenStart?(): void; /** * Event handler called when the MpnSubscriptionListener instance is removed from an {@link MpnSubscription} through * {@link MpnSubscription#removeListener}.
* This is the last event to be fired on the listener. */ onListenEnd?(): void; /** * Event handler called when an {@link MpnSubscription} has been successfully subscribed to on the server's MPN Module.
* This event handler is always called before other events related to the same subscription.
* Note that this event can be called multiple times in the life of an MpnSubscription instance only in case it is subscribed multiple times * through {@link LightstreamerClient#unsubscribeMpn} and {@link LightstreamerClient#subscribeMpn}. Two consecutive calls * to this method are not possible, as before a second onSubscription() event an {@link MpnSubscriptionListener#onUnsubscription} event is always fired. */ onSubscription?(): void; /** * Event handler called when an {@link MpnSubscription} has been successfully unsubscribed from on the server's MPN Module.
* After this call no more events can be received until a new {@link MpnSubscriptionListener#onSubscription} event.
* Note that this event can be called multiple times in the life of an MpnSubscription instance only in case it is subscribed multiple times * through {@link LightstreamerClient#unsubscribeMpn} and {@link LightstreamerClient#subscribeMpn}. Two consecutive calls * to this method are not possible, as before a second onUnsubscription() event an {@link MpnSubscriptionListener#onSubscription} event is always fired. */ onUnsubscription?(): void; /** * Event handler called when the server notifies an error while subscribing to an {@link MpnSubscription}.
* By implementing this method it is possible to perform recovery actions. * @param code - The error code sent by the Server. It can be one of the following: * @param message - The description of the error sent by the Server; it can be null. */ onSubscriptionError?(code: number, message: string): void; /** * Event handler called when the server notifies an error while unsubscribing from an {@link MpnSubscription}.
* By implementing this method it is possible to perform recovery actions. * @param code - The error code sent by the Server. It can be one of the following: * @param message - The description of the error sent by the Server; it can be null. */ onUnsubscriptionError?(code: number, message: string): void; /** * Event handler called when the server notifies that an {@link MpnSubscription} did trigger.
* For this event to be called the MpnSubscription must have a trigger expression set and it must have been evaluated to true at * least once.
* Note that this event can be called multiple times in the life of an MpnSubscription instance only in case it is subscribed multiple times * through {@link LightstreamerClient#unsubscribeMpn} and {@link LightstreamerClient#subscribeMpn}. Two consecutive calls * to this method are not possible.
* Note also that in some server clustering configurations this event may not be called. The corresponding push notification is always sent, though. */ onTriggered?(): void; /** * Event handler called when the server notifies that an {@link MpnSubscription} changed its status.
* Note that in some server clustering configurations the status change for the MPN subscription's trigger event may not be called. The corresponding push * notification is always sent, though. * @param status - The new status of the MPN subscription. It can be one of the following: * @param timestamp - The server-side timestamp of the new subscription status. */ onStatusChanged?(status: string, timestamp: number): void; /** * Event handler called each time the value of a property of {@link MpnSubscription} is changed.
* Properties can be modified by direct calls to their setter or by server sent events. A property may be changed by a server sent event when the MPN subscription is * modified, or when two MPN subscriptions coalesce (see {@link LightstreamerClient#subscribeMpn}). * @param propertyName - The name of the changed property. It can be one of the following: */ onPropertyChanged?(propertyName: string): void; /** * Event handler called when the value of a property of {@link MpnSubscription} cannot be changed.
* Properties can be modified by direct calls to their setters. See {@link MpnSubscription#setNotificationFormat} and {@link MpnSubscription#setTriggerExpression}. * @param code - The error code sent by the Server. * @param message - The description of the error sent by the Server. * @param propertyName - The name of the changed property. It can be one of the following: */ onModificationError?(code: number, message: string, propertyName: string): void; } /** * This is an abstract class; no instances of this class should be created. */ export class AbstractWidget extends SubscriptionListener { constructor(); /** * Removes a row from the internal model and reflects the change on the view. * If no row associated with the given key is found nothing is done. * *

Lifecycle: once the {@link AbstractWidget#parseHtml} method has been called, * this method can be used at any time.

* @param key - The key associated with the row to be removed. */ removeRow(key: string): void; /** * Updates a row in the internal model and reflects the change on the view. * If no row associated with the given key is found then a new row is * created. *
Example usage: *
myWidget.updateRow("key1", {field1:"val1",field2:"val2"}); * *

Lifecycle: once the {@link AbstractWidget#parseHtml} method has been called, * this method can be used at any time. If called while an updateRow on the same * internal model is still executing (e.g. if called while handling an onVisualUpdate * callback), then the new update: *

*

* @param key - The key associated with the row to be updated/added. * @param newValues - A JavaScript object containing name/value pairs * to fill the row in the mode. *
Note that the internal model does not have a fixed number of fields; * each update can add new fields to the model by simply specifying them. * Also, an update having fewer fields than the current model will have its * missing fields considered as unchanged. */ updateRow(key: string, newValues: any): void; /** * Removes all the rows from the model and reflects the change on the view. * *

Lifecycle: once the {@link AbstractWidget#parseHtml} method has been called, * this method can be used at any time.

*/ clean(): void; /** * Returns the value from the model for the specified key/field pair. * If the row for the specified key does not exist or if the specified field * is not available in the row then null is returned. * *

Lifecycle: This method can be called at any time.

* @param key - The key associated with the row to be read. * @param field - The field to be read from the row. * @returns The current value for the specified field of the specified row, * possibly null. If the value for the specified field has never been * assigned in the model, the method also returns null. */ getValue(key: string, field: string): string; /** * Utility method that can be used to control part of the behavior of * the widget in case it is used as a listener for one or more * {@link Subscription} instances. *
Specifying the two flags it is possible to decide to clean the model and * view based on the status (subscribed or not) of the Subscriptions this * instance is listening to. * *

Lifecycle: This method can be called at any time.

* @param onFirstSubscribe - If true a {@link AbstractWidget#clean} call will be * automatically performed if in the list of Subscriptions this instance is * listening to there is no Subscription in the subscribed status and an * onSubscription is fired by one of such Subscriptions. *
As a special case, if in the list of Subscriptions this instance is * listening to there is no Subscription in the subscribed status and this * instance starts listening to a new Subscription that is already in the * subscribed status, then it will be considered as if an onSubscription * event was fired and thus a clean() call will be performed. * @param onLastUnsubscribe - If true a {@link AbstractWidget#clean} call will be * automatically performed if in the list of Subscriptions this instance is * listening to there is only one Subscription in the subscribed status and the * onUnsubscription for such Subscription is fired. *
As a special case, if in the list of Subscriptions this instance is * listening to there is only one Subscription in the subscribed status and * this instance stops listening to such Subscription then it will be * considered as if the onUnsubscription event for that Subscription was fired * and thus a clean() call will be performed. */ setAutoCleanBehavior(onFirstSubscribe: boolean, onLastUnsubscribe: boolean): void; /** * Abstract method. See subclasses descriptions for details. */ parseHtml(): void; /** * Event handler that is called by Lightstreamer each time an update * pertaining to an item in the Subscription has been received from the * Server. * @param updateInfo - a value object containing the * updated values for all the fields, together with meta-information about * the update itself and some helper methods that can be used to iterate through * all or new values. */ onItemUpdate(updateInfo: ItemUpdate): void; /** * Event handler that is called by Lightstreamer each time a request * to clear the snapshot pertaining to an item in the Subscription has been * received from the Server. * More precisely, this kind of request can occur in two cases: * *
Note that, if the involved Subscription has a two-level behavior enabled, * the notification refers to the first-level item (which is in COMMAND mode). * This kind of notification is not possible for second-level items (which are in * MERGE mode). *
This event can be sent by the Lightstreamer Server since version 6.0 * @param itemName - name of the involved item. If the Subscription * was initialized using an "Item Group" then a null value is supplied. * @param itemPos - 1-based position of the item within the "Item List" * or "Item Group". */ onClearSnapshot(itemName: string, itemPos: number): void; /** * Event handler that is called by Lightstreamer to notify that a Subscription * has been successfully subscribed to through the Server. * This can happen multiple times in the life of a Subscription instance, * in case the Subscription is performed multiple times through * {@link LightstreamerClient#unsubscribe} and {@link LightstreamerClient#subscribe}. * This can also happen multiple times in case of automatic recovery after a connection * restart. *
This notification is always issued before the other ones related * to the same subscription. It invalidates all data that has been received * previously. *
Note that two consecutive calls to this method are not possible, as before * a second onSubscription event is fired an onUnsubscription event is eventually * fired. *
If the involved Subscription has a two-level behavior enabled, * second-level subscriptions are not notified. */ onSubscription(): void; /** * Event handler that is called by Lightstreamer to notify that a Subscription * has been successfully unsubscribed from. * This can happen multiple times in the life of a Subscription instance, * in case the Subscription is performed multiple times through * {@link LightstreamerClient#unsubscribe} and {@link LightstreamerClient#subscribe}. * This can also happen multiple times in case of automatic recovery after a connection * restart. * *
After this notification no more events can be recieved until a new * {@link SubscriptionListener#onSubscription} event. *
Note that two consecutive calls to this method are not possible, as before * a second onUnsubscription event is fired an onSubscription event is eventually * fired. *
If the involved Subscription has a two-level behavior enabled, * second-level unsubscriptions are not notified. */ onUnsubscription(): void; /** * Event handler that receives a notification when the SubscriptionListener instance * is added to a Subscription through * {@link Subscription#addListener}. * This is the first event to be fired on the listener. */ onListenStart(): void; /** * Event handler that receives a notification when the SubscriptionListener instance * is removed from a Subscription through * {@link Subscription#removeListener}. * This is the last event to be fired on the listener. */ onListenEnd(): void; } /** * Used by Lightstreamer to provide a ChartLine object to each call of the * {@link ChartListener#onNewLine} event. * This constructor is not supposed to be used by custom code. */ export class ChartLine { constructor(); /** * Setter method that configures the legend for the Y axis. The legend * consists of a specified number of labels for the values in the Y axis. * The labels values are determined based on the axis limits; the labels * appearance is controlled by supplying a stylesheet and a formatter * function. *
Note that the room for the Y axis labels on the page is not provided * by the library; it should be provided by specifying a chart width * smaller then the container element width and displaced on the right, * through the {@link Chart#configureArea} setting. * Moreover, as the upmost and lowest labels are centered on the chart * area borders, a little space should be provided also over and under * the chart area, through the same method. * *

Lifecycle: Labels can be configured at any time. * If not set, no labels are displayed relative to the Y axis. * If set for different ChartLine instances on the same Chart * then more sets of labels will be printed.

* @param labelsNum - the number of labels to be spread on the * Y axis; it should be 1 or greater. * @param [labelsClass] - the name of an existing stylesheet, to be * applied to the Y axis label HTML elements. The parameter is optional; * if missing or null, then no specific stylesheet is applied. * @param [labelsFormatter] - a Function instance * used to format the Y axis values designated for the labels. *
The function will be invoked with a Number argument and should return a String. * If the function is not supplied, then the value will be used with no further formatting. */ setYLabels(labelsNum: number, labelsClass?: string, labelsFormatter?: LabelsFormatter): void; /** * Setter method that sets the style to be applied to the points * drawn on the chart area. Colors of the points, * and lines can be customized using valid CSS colors while size is specified * in pixels. * @param [pointColor = black] - color use to draw the points on the chart. * A point is drawn per each new value in the model. Any valid CSS color can * be used. By default "black" is used. * @param [lineColor = black] - the color use to draw the lines on the chart. * A line is to connect two consecutive points for the same line. * Any valid CSS color can be used. By default "black" is used. * @param [pointSize = 1] - the size in pixel of the drawn points. * By default 1 is used. * @param [lineSize = 1] - the size in pixel of the drawn lines. * By default 1 is used. */ setStyle(pointColor?: string, lineColor?: string, pointSize?: number, lineSize?: number): void; /** * Operation method that sets or changes the limits for the visible part * of the Y axis of the chart (that is, the minimum and maximum Y-coordinates * shown in the chart for this line). * When these limits are changed a full repaint of the line is performed. * *

Lifecycle: The Y axis limits can be set at any time.

* @param min - lower limit for the visible part of the Y axis. * @param max - higher limit for the visible part of the Y axis. */ positionYAxis(min: number, max: number): void; /** * Inquiry method that retrieves the field in the Chart internal model * representing the Y axis to which this ChartLine pertains. * @returns the field representing the Y axis. */ getYField(): number; } /** * Creates an object that extends {@link AbstractWidget} displaying its values * as a multiline chart. *
Note that the {@link AbstractWidget#parseHtml} method is automatically called by this * constructor, hence the container element should have already been prepared on the page DOM. * However, preparing the element later and then invoking {@link AbstractWidget#parseHtml} * manually is also supported. * @param id - The HTML "id" attribute of a DOM Element to which the chart will be attached. */ export class Chart extends AbstractWidget { constructor(id: string); /** * This method is automatically called by the constructor of this class. * It will bind the current instance with the HTML element having the id * specified in the constructor. */ parseHtml(): void; /** * Setter method that sets the stylesheet and positioning to be applied to * the chart area. * *

Lifecycle: The chart area stylesheet and position attributes * can be set and changed at any time.

* @param [chartCss] - the name of an existing stylesheet to be applied to * the chart. If not set, the stylesheet is inherited from * the DOM element containing the chart. * @param [chartHeight] - the height in pixels of the chart area. * Such height may be set as smaller than the height of the container * HTML element in order to make room for the X axis labels. If not set, * the whole height of the container HTML element is used. * @param [chartWidth] - the width in pixels of the chart area. * Such width may be set as smaller than the width of the container HTML * element in order to make room for the Y axis labels. If not set, * the whole width of the container HTML element is used. * @param [chartTop = 0] - the distance in pixels between the top margin of the * chart area and the top margin of the container HTML element. * Such distance may be set as a nonzero value in order to make room for * the first Y axis label. If not set, 0 is used. * @param [chartLeft = 0] - the distance in pixels between the left margin of * the chart area and the left margin of the container HTML element. * Such distance may be set as a nonzero value in order to make room for the * Y axis labels. If not set, 0 is used. */ configureArea(chartCss?: string, chartHeight?: number, chartWidth?: number, chartTop?: number, chartLeft?: number): void; /** * Setter method that sets the field to be used as the source of the * X-coordinate for each update. An optional parser can be passed to normalize * the value before it is used to plot the chart. * The resulting values should be in the limits posed by the * {@link Chart#positionXAxis} method, otherwise a * {@link ChartListener#onXOverflow} event is fired to handle the situation. * null can also be specified, in which case, if the associated Y value is null * the chart will be cleared, otherwise the update will be ignored. * *

Lifecycle: The X axis field can be set at any time. * Until set, no chart will be printed. If already set, the new setting only * affects the new points while all the previously plotted points are cleaned.

* @param field - A field name representing the X axis. * @param [xParser] - A parser function that can be used to normalize * the value of the X field before using it to plot the chart. * If the function is not supplied, * then the field values should represent valid numbers in JavaScript or be null. */ setXAxis(field: string, xParser?: CustomParserFunction): void; /** * Adds field(s) to be used as the source of the Y-coordinate for each update * An optional parser can be passed to normalize the value before it is used to * plot the chart. * The resulting values should be in the limits posed by the * {@link ChartLine#positionYAxis} related to the involved line, otherwise a * {@link ChartListener#onYOverflow} event is fired to handle the situation. * null can also be specified, in which case, if the associated X value is null * the chart line will be cleared, otherwise the update will be ignored. *
It is possible to specify an array of fields instead of specifying a * single field. If that's the case multiple chart lines will be generated * per each row in the model. *
Note that for each field in the underlying model it is possible to associate * only one line. If multiple lines based on the same fields are needed, dedicated * fields should be added to the model, through {@link AbstractWidget#updateRow}. * In case this instance is used to listen to events from {@link Subscription} * instance(s), updateRow() can be invoked from within {@link SubscriptionListener#onItemUpdate}. * *

Lifecycle: The method can be invoked at any time, in order to * add fields to be plotted or in order to change the parser associated to * fields already being plotted. * Until invoked for the first time, no chart will be printed.

* @param field - A field name representing the Y axis. An array * of field names can also be passed. Each field will generate its own line. * @param [yParser] - A parser function that can be used to normalize * the value of the Y field before using it to plot the chart. * If the function * is not supplied, then the field values should represent valid numbers in JavaScript or be null. *
If an array has been specified for the field parameter, then an array of parser functions can * also be passed. Each parser will be executed on the field having the same index * in the array. On the other hand, if an array of fields is passed but only one * parser has been specified, then the parser will be applied to all of the fields. */ addYAxis(field: string, yParser?: CustomParserFunction | CustomParserFunction[]): void; /** * Removes field(s) currently used as the source of the Y-coordinate for each update * and all the related {@link ChartLine}. *
It is possible to specify an array of fields instead of specifying a * single field. If that's the case all the specified fields and related chart lines * will be removed. * *

Lifecycle: The method can be invoked at any time, in order to * remove plotted fields.

* @param field - A field name representing the Y axis. An array * of field names can also be passed. */ removeYAxis(field: string): void; /** * Operation method that sets or changes the limits for the visible part * of the X axis of the chart (that is, the minimum and maximum X-coordinates * shown in the chart). * If these limits are changed while the internal model is not empty * then this causes a repaint of the whole chart. *
Note that rising the minimum X value shown also clears from * the memory all the points whose X value becomes lower. So, those points * will not be displayed again after lowering again the minimum X value. * *

Lifecycle: The X axis limits can be set at any time.

* @param min - lower limit for the visible part of the X axis. * @param max - higher limit for the visible part of the X axis. */ positionXAxis(min: number, max: number): void; /** * Setter method that configures the legend for the X axis. The legend * consists of a specified number of labels for the values in the X axis. * The labels values are determined based on the axis limits; the labels * appearance is controlled by supplying a stylesheet and a formatter * function. *
Note that the room for the X axis labels on the page is not provided * by the library; it should be provided by specifying a chart height * smaller than the container element height, through the * {@link Chart#configureArea} setting. Moreover, as the first and last labels * are centered on the chart area borders, a suitable space should be * provided also on the left and right of the chart area, through the * same method. * *

Lifecycle: Labels can be configured at any time. * If not set, no labels are displayed relative to the X axis.

* @param labelsNum - the number of labels to be spread on the * X axis; it should be 1 or greater. * @param [labelsClass] - the name of an existing stylesheet, to be * applied to the X axis label HTML elements. The parameter is optional; * if missing or null, then no specific stylesheet will be applied. * @param [labelsFormatter] - a Function instance * used to format the X axis values designated for the labels. * If the function is not supplied, then the value will be used with no further formatting. */ setXLabels(labelsNum: number, labelsClass?: string, labelsFormatter?: LabelsFormatter): void; /** * Adds a listener that will receive events from the Chart * instance. *
The same listener can be added to several different Chart * instances. * *

Lifecycle: a listener can be added at any time.

* @param listener - An object that will receive the events * as shown in the {@link ChartListener} interface. *
Note that the given instance does not have to implement all of the * methods of the ChartListener interface. In fact it may also * implement none of the interface methods and still be considered a valid * listener. In the latter case it will obviously receive no events. */ addListener(listener: ChartListener): void; /** * Removes a listener from the Chart instance so that it * will not receive events anymore. * *

Lifecycle: a listener can be removed at any time.

* @param listener - The listener to be removed. */ removeListener(listener: ChartListener): void; /** * Returns an array containing the {@link ChartListener} instances that * were added to this client. * @returns an array containing the listeners that were added to this instance. * Listeners added multiple times are included multiple times in the array. */ getListeners(): ChartListener[]; /** * Event handler that receives a notification when the SubscriptionListener instance * is added to a Subscription through * {@link Subscription#addListener}. * This is the first event to be fired on the listener. */ onListenStart(): void; /** * Removes all the rows from the model and reflects the change on the view. * *

Lifecycle: once the {@link AbstractWidget#parseHtml} method has been called, * this method can be used at any time.

*/ clean(): void; } /** * This is an abstract class; no instances of this class should be created. */ export class AbstractGrid extends AbstractWidget { constructor(); /** * Setter method that enables or disables the interpretation of the * values in the model as HTML code. * For instance, if the value "<a href='news03.htm'>Click here</a>" * is placed in the internal model (either by manual call of the * {@link AbstractWidget#updateRow} method or by listening on a * {@link SubscriptionListener#onItemUpdate} event) * and HTML interpretation is enabled, then the target cell * will contain a link; otherwise it will contain that bare text. * Note that the setting applies to all the cells in the associated grid. * Anyway if it's not the content of a cell that is going to be updated, * but one of its properties, then this setting is irrelevant for such cell. *
WARNING: When turning HTML interpretation on, make sure that * no malicious code may reach the internal model (for example * through the injection of undesired JavaScript code from the Data Adapter). * *

Default value: false.

* *

Lifecycle: this setting can be changed at any time. *
Note that values that have already been placed in the grid cells will not * be updated to reflect the new setting.

* @param enable - true/false to enable/disable HTML interpretation * for the pushed values. */ setHtmlInterpretationEnabled(enable: boolean): void; /** * Inquiry method that gets the type of interpretation to be applied for * the pushed values for this grid. In fact, the values can be * put in the target cells as HTML code or as text. * @returns true if pushed values are interpreted as HTML code, false * otherwise. */ isHtmlInterpretationEnabled(): boolean; /** * Setter method that specifies a list of HTML element types to be searched for * during the mapping of the grid to the HTML made by {@link AbstractGrid#parseHtml}. * *

Default value: an array containing DIV SPAN and INPUT.

* *

Lifecycle: Node types can be specified at any time. * However, if the list is changed after the execution of the {@link AbstractGrid#parseHtml} * method then it will not be used until a new call to such method is performed. *

* @param nodeTypes - an array of Strings representing the names of the node * types to be searched for. If the array contains an asterisk (*) then all the * node types will be checked. */ setNodeTypes(nodeTypes: String[]): void; /** * Inquiry method that gets the list of node of types that would be searched * in case of a call to {@link AbstractGrid#parseHtml}. * @returns a list of node type names. */ getNodeTypes(): String[]; /** * Setter method that decides whenever new rows entering the model will be * placed at the top of the grid or at the bottom. *
Note that if the sort is enabled on the Grid through {@link AbstractGrid#setSort} * then this setting is ignored as new rows will be placed on their right * position based on the sort configuration. *
Also note that the sort/add policy may be ignored depending on the grid * configuration; see the use of the "data-item" cell attribute in {@link StaticGrid}. * *

Default value: false.

* *

Lifecycle: this setting can be changed at any time. *
Note anyway that changing this setting while the internal model * is not empty may result in a incosistent view.

* @param isAddOnTop - true/false to place new rows entering the model * as the first/last row of the grid. */ setAddOnTop(isAddOnTop: boolean): void; /** * Inquiry method that gets true/false depending on how new rows * entering the grid are treated. If true is returned, new rows will be placed on top of * the grid. Viceversa, if false is returned, new rows are placed at the * bottom. * @returns true if new rows are added on top, false otherwise. */ isAddOnTop(): boolean; /** * Setter method that configures the sort policy of the grid. If no * sorting policy is set, new rows are always added according with the * {@link AbstractGrid#setAddOnTop} setting. * If, on the other hand, sorting is enabled, then new * rows are positioned according to the sort criteria. * Sorting is also maintained upon update of an existing row; this may cause the row to be * repositioned. *
If asynchronous row repositioning is undesired, it is possible to * set the sort and immediately disable it with two consecutive calls * to just enforce grid sorting based on the current contents. *
The sort can also be performed on fields that are part of the model * but not part of the grid view. *
Note that the sort/add policy may be ignored depending on the grid * configuration; see the use of the "data-item" cell attribute in {@link StaticGrid}. * *

Default value: no sort is performed.

* *

Lifecycle: The sort configuration can be set and changed * at any time.

* @param sortField - The name of the field to be used as sort field, * or null to disable sorting. * @param [descendingSort = false] - true or false to perform descending or * ascending sort. This parameter is optional; if missing or null, * then ascending sort is performed. * @param [numericSort = false] - true or false to perform numeric or * alphabetical sort. This parameter is optional; if missing or null, then * alphabetical sort is performed. * @param [commaAsDecimalSeparator = false] - true to specify that sort * field values are decimal numbers in which the decimal separator is * a comma; false to specify it is a dot. This setting is used only if * numericSort is true, in which case it is optional, with false as its * default value. */ setSort(sortField: string, descendingSort?: boolean, numericSort?: boolean, commaAsDecimalSeparator?: boolean): void; /** * Inquiry method that gets the name of the field currently used as sort * field, if available. * @returns The name of a field, or null if sorting is not currently * enabled. */ getSortField(): number; /** * Inquiry method that gets the sort direction currently configured. * @returns true if descending sort is being performed, false if ascending * sort is, or null if sorting is not currently enabled. */ isDescendingSort(): boolean; /** * Inquiry method that gets the type of sort currently configured. * @returns true if numeric sort is being performed, false if alphabetical * sort is, or null if sorting is not currently enabled. */ isNumericSort(): boolean; /** * Inquiry method that gets the type of interpretation to be used to * parse the sort field values in order to perform numeric sort. * @returns true if comma is the decimal separator, false if it is a dot; * returns null if sorting is not currently enabled or numeric sorting * is not currently configured. */ isCommaAsDecimalSeparator(): boolean; /** * Creates an array containing all the unique values of the "data-field" * properties in all of the HTML elements associated to this grid during the * {@link AbstractGrid#parseHtml} execution. The result of this method is supposed to be * used as "Field List" of a Subscription. *
Execution of this method is pointless if HTML elements associated to this * grid specify a field position instead of a field name in their "data-field" * property. *
Note that elements specifying the "data-fieldtype" property set to "extra" or "second-level", * will be ignored by this method. This permits to distinguish fields that are part * of the main subscription (not specifying any "data-fieldtype" or specifying "first-level"), part of a * second-level Subscription (specifying "second-level") and not part of a Subscription at all, * but still manageable in a direct way (specifying "extra"). * @returns The list of unique values found in the "data-field" properties * of HTML element of this grid. */ extractFieldList(): String[]; /** * Creates an array containing all the unique values, of the "data-field" properties * in all of the HTML elements, having the "data-fieldtype" property set to "second-level", * associated to this grid during the {@link AbstractGrid#parseHtml} execution. *
The result of this method is supposed to be * used as "Field List" of a second-level Subscription. *
Execution of this method is pointless if HTML elements associated to this * grid specify a field position instead of a field name in their "data-field" * property. * @returns The list of unique values found in the "data-field" properties * of HTML element of this grid. */ extractCommandSecondLevelFieldList(): String[]; /** * Operation method that is used to authorize and execute the binding of the * widget with the HTML of the page. * *

Lifecycle: This method can only be called once the HTML structure * the instance is expecting to find are ready in the DOM. * That said, it can be invoked at any time and subsequent invocations will update * the binding to the current state of the page DOM. Anyway, newly found cells * will be left empty until the next update involving them.

*/ parseHtml(): void; /** * Operation method that is used to force the choice of what to use * as key for the integration in the internal model, when receiving * an update from a Subscription this grid is listening to. *
Specifying "ITEM_IS_KEY" tells the widget to use the item as key; * this is the behavior that is already the default one when the Subscription * is in "MERGE" or "RAW" mode (see {@link AbstractWidget} for details). *
Specifying "UPDATE_IS_KEY" tells the widget to use a progressive number * as key; this is the behavior that is already the default one when the * Subscription is in "DISTINCT" mode (see {@link AbstractWidget} for details). *
Note that when listening to different Subscriptions the default behavior * is set when the grid is added as listener for the first one and then applied * to all the others regardless of their mode. * *

Lifecycle:this method can only be called * while the internal model is empty.

* @param interpretation - either "ITEM_IS_KEY" or "UPDATE_IS_KEY", * or null to restore the default behavior. */ forceSubscriptionInterpretation(interpretation: string): void; } /** * Used by Lightstreamer to provide a value object to each call of the * {@link StaticGridListener#onVisualUpdate} and * {@link DynaGridListener#onVisualUpdate} events. This constructor * is not supposed to be used by custom code. */ export class VisualUpdate { constructor(); /** * Inquiry method that gets the value that is going to be shown in the grid * in a specified cell or the current value if the value is not going to be * changed. *
Note that if the value is not changing then no effects or styles are * going to be applied on the cell itself. If the effect is desired even if * the value in the cell is unchanged, then a call to {@link VisualUpdate#setCellValue} can * be performed using the value from this getter. *
In order to inquiry the values for the row cells on the underlying * model, the {@link VisualUpdate#getChangedFieldValue} method is available. * @param field - The field name associated with one of the cells in the * grid (the "data-field" attribute). * @param [replicaId] - A custom identifier that can be used in case two * or more cells were defined for the same field (the "data-replica" attribute). * If more cells have been defined but this parameter is not specified, then a random * cell will be selected. * @returns A text or null; if the value for the specified field has never been * assigned in the model, the method also returns null. */ getCellValue(field: string, replicaId?: string): string; /** * Setter method that assigns the value to be shown in a specified cell of * the grid. * The specified value is the text that will be actually written in the cell * (for instance, it may be a formatted version of the original value), * unless it is null, in which case the value currently shown will be kept. * The latter may still be the initial cell value (or the cell value * specified on the template) if no formatted value hasn't been supplied * for the field yet. *
Note that this method does not update the internal model of the AbstractGrid * so that if a value is set through this method it can't be used * for features working on such model (e.g. it can't be used to sort the grid). * If a change to the model is required use the {@link AbstractWidget#updateRow} method. * @param field - The field name associated with one of the cells in the * grid (the "data-field" attribute). * @param value - the value to be written in the cell, or null. * @param [replicaId] - A custom identifier that can be used in case two * or more cells were defined for the same field (the "data-replica" attribute). * If more cells were defined but this parameter is not specified, then a random * cell will be selected. */ setCellValue(field: string, value: string, replicaId?: string): void; /** * Inquiry method that gets the value that is going to update the underlying * model of the grid for the associated field. It can be null if no change * for the specified field is going to be applied. * @param field - The name of a field from the model. * @returns The new value of the specified field (possibly null), or null * if the field is not changing. * If the value for the specified field has never been * assigned in the model, the method also returns null. */ getChangedFieldValue(field: string): string; /** * Setter method that configures the length of the "hot" phase for the * current row. The "hot" phase is one of the phases of the visual effect * supplied by Lightstreamer to emphasize the change of the row values. *
By default 1200 ms is set. * @param val - Duration in milliseconds of the "hot" phase. */ setHotTime(val: number): void; /** * Setter method that configures the length of the color fading phase * before the "hot" phase. This fading phase is one of the phases of * the visual effect supplied by Lightstreamer to emphasize the change * of the row values. A 0 length means that the color switch to "hot" * colors should be instantaneous and should happen together with value * and stylesheet switch. *
Warning: The fading effect, if enabled, may be computation * intensive for some client environments, when high-frequency updates * are involved. *
By default 0 ms (no fading at all) is set. * @param val - Duration in milliseconds of the fading phase before * the "hot" phase. */ setColdToHotTime(val: number): void; /** * Setter method that configures the length of the color fading phase * after the "hot" phase. This fading phase is one of the phases of * the visual effect supplied by Lightstreamer to emphasize the change * of the row values. A 0 length means that the color switch from "hot" * to final "cold" colors should be instantaneous and should happen * together with the stylesheet switch. *
Warning: The fading effect, if enabled, may be very computation * intensive for some client environments, when high-frequency updates * are involved. *
By default 0 ms (no fading at all) is set. * @param val - Duration in milliseconds of the fading phase after * the "hot" phase. */ setHotToColdTime(val: number): void; /** * Setter method that configures the stylesheet changes to be applied * to all the HTML cells of the involved row, while changing the field values. * A temporary "hot" style can * be specified as different than the final "cold" style. This allows * Lightstreamer to perform a visual effect, in which a temporary "hot" * phase is visible. By using this method, stylesheet attributes can be * specified one at a time. *
If nonzero fading times are specified, through * {@link VisualUpdate#setColdToHotTime} and/or {@link VisualUpdate#setHotToColdTime}, * then the "color" and "backgroundColor" attributes, if set, will be * changed with a fading behaviour. * Note that if color attributes are not set and nonzero fading times are * specified in {@link VisualUpdate#setColdToHotTime} and/or {@link VisualUpdate#setHotToColdTime}, * this will cause a delay of the "hot" and "cold" phase switches; * however, as fading times refer to the whole row, you may need to set * them as nonzero in order to allow fading on some specific fields only. *
If a row stylesheet is set through the {@link VisualUpdate#setStyle} method, * then this method should be used only to set stylesheet properties * not set by the row stylesheet. This condition applies throughout the * whole lifecycle of the cell (i.e. manipulating the same style property * through both methods, even at different times, does not guarantee * the result). *
By default for each stylesheet attribute that is not * specified neither with this method nor with {@link VisualUpdate#setStyle}, the * current value is left unchanged. * @param hotValue - the temporary "hot" value for the involved * attribute, or null if the attribute should not change while entering * "hot" phase; an empty string causes the current attribute value * to be cleared. * @param coldValue - the final "cold" value for the involved * attribute, or null if the attribute should not change while exiting * "hot" phase; an empty string causes the "hot" phase attribute value * to be cleared. * @param attrName - the name of an HTML stylesheet attribute. * The DOM attribute name should be used, not the CSS name (e.g. * "backgroundColor" is accepted, while "background-color" is not). * Note that if the "color" or "backgroundColor" attribute is being set, * then several color name conventions are supported by the underlying * DOM manipulation functions; however, in order to take advantage of the * color fading support, only the "#RRGGBB" syntax is fully supported. */ setAttribute(hotValue: string, coldValue: string, attrName: string): void; /** * Setter method that configures the stylesheets to be applied to the * HTML cells of the involved row, while changing the field values. * A temporary "hot" style can * be specified as different than the final "cold" style. This allows * Lightstreamer to perform a visual effect, in which a temporary "hot" * phase is visible. By using this method, the names of existing * stylesheets are supplied. *
Note that in order to specify cell colors that can change with * a fading behavior, the {@link VisualUpdate#setAttribute} method should be used instead, * as fading is not supported when colors are specified in the stylesheets * with this method. So, if nonzero fading times are specified in * {@link VisualUpdate#setColdToHotTime} and/or {@link VisualUpdate#setHotToColdTime}, * this will just cause a delay of the "hot" and "cold" phase switches; * however, as fading times refer to the whole row, you may need to set * them as nonzero in order to allow fading on some specific fields only. * for each stylesheet attribute that is not * specified neither with this method nor with {@link VisualUpdate#setStyle}, the * current value is left unchanged. *
By default no stylesheet is applied to the cell. * @param hotStyle - the name of the temporary "hot" stylesheet, * or null if the cells style should not change while entering "hot" phase. * @param coldStyle - the name of the final "cold" stylesheet, * or null if the cells style should not change while exiting "hot" phase. */ setStyle(hotStyle: string, coldStyle: string): void; /** * Setter method that configures the stylesheet changes to be applied * to the HTML cell related with a specified field, while changing its * value. * The method can be used to override, for a specific field, the settings * made through {@link VisualUpdate#setAttribute}. *
If a specific stylesheet is assigned to the field through the * {@link VisualUpdate#setStyle} or {@link VisualUpdate#setCellStyle} method, * then this method can be used only in order to set stylesheet properties * not set by the assigned specific stylesheet. This condition applies * throughout the whole lifecycle of the cell (i.e. it is discouraged * to manipulate the same style property through both methods, * even at different times). *
By default the settings possibly made by {@link VisualUpdate#setAttribute} * are used.

* @param field - The field name associated with one of the cells in the * grid (the "data-field" attribute). * @param hotValue - the temporary "hot" value for the involved * attribute, or null if the attribute should not change while entering * "hot" phase; an empty string causes the current attribute value * to be cleared. * @param coldValue - the final "cold" value for the involved * attribute, or null if the attribute should not change while exiting * "hot" phase; an empty string causes the "hot" phase attribute value * to be cleared. * @param attrName - the name of an HTML stylesheet attribute. * The DOM attribute name should be used, not the CSS name (e.g. * "backgroundColor" is accepted, while "background-color" is not). * @param [replicaId] - A custom identifier that can be used in case two * or more cells were defined for the same field (the "data-replica" attribute). * If more cells were defined but this parameter is not specified, then a random * cell will be selected. */ setCellAttribute(field: string, hotValue: string, coldValue: string, attrName: string, replicaId?: string): void; /** * Setter method that configures the stylesheet to be applied to the * HTML cell related with a specified field, while changing its value. *
This method can be used to override, for a specific field, the settings * made through {@link VisualUpdate#setStyle}. *
By default the stylesheet possibly set through {@link VisualUpdate#setStyle} * is used.

* @param field - The field name associated with one of the cells in the * grid (the "data-field" attribute). * @param hotStyle - the name of the temporary "hot" stylesheet, * or null if the cell style should not change while entering "hot" phase * (regardless of the settings made through {@link VisualUpdate#setStyle} and * {@link VisualUpdate#setAttribute}). * @param coldStyle - the name of the final "cold" stylesheet, * or null if the cell style should not change while exiting "hot" phase * (regardless of the settings made through {@link VisualUpdate#setStyle} and * {@link VisualUpdate#setAttribute}). * @param [replicaId] - A custom identifier that can be used in case two * or more cells were defined for the same field (the "data-replica" attribute). * If more cells were defined but this parameter is not specified, then a random * cell will be selected. */ setCellStyle(field: string, hotStyle: string, coldStyle: string, replicaId?: string): void; /** * Receives an iterator function and invokes it once per each field * of the underlying model changed with the current update. *
Note that in case of an event generated by the creation of a new row * all the field will be iterated. *
Note that the iterator is executed before this method returns. *
Note that the iterator will iterate through all of the changed fields * including fields not having associated cells. Also, even if a field is * associated with more cells it will be passed to the iterator only once. * @param iterator - Function instance that will be called once per * each field changed on the current update on the internal model. */ forEachChangedField(iterator: ChangedFieldCallback): void; } /** * Creates an object that extends {@link AbstractGrid} displaying its values * in a grid made of HTML elements. The grid rows are displayed into dynamically * generated HTML rows. The object can be supplied to * {@link Subscription#addListener} and {@link Subscription#removeListener} * in order to display data from one or more Subscriptions. * @param id - The HTML "id" attribute of the HTML element that represents the template from * which rows of the grid will be cloned. The template can be either a visible * or a hidden part of the page; anyway, it will become invisible * as soon as the {@link AbstractGrid#parseHtml} method is executed. * @param autoParse - If true the {@link AbstractGrid#parseHtml} method is executed * before the constructor execution is completed. If false the parseHtml method * has to be called later by custom code. It can be useful to set this flag * to false if, at the time of the DynaGrid instance creation, the HTML element * designated as template is not yet ready on the page. */ export class DynaGrid extends AbstractGrid { constructor(id: string, autoParse: boolean); /** * Setter method that sets the maximum number of visible rows allowed * in the grid. * If a value for this property is set, then Lightstreamer * maintains a paging mechanism, such that only one logical page is * displayed at a time. Logical page 1 is shown by default, but each * logical page can be shown by calling the {@link DynaGrid#goToPage} method. *
Note that, due to the dynamical nature of the grid, * logical pages other than page 1 may underlie to scrolling caused by * operations on rows belonging to lower logical pages; this effect * is emphasized if sorting is active. *
Note that if this instance is used to listen to events from * {@link Subscription} instance(s), and the first Subscription it listens to is * a DISTINCT Subscription, then the behavior is different: when the limit * posed by this setting is reached, adding a new row will always * cause the removal of the oldest row from the model, with a * consequent repositioning of the remaining rows. * *

Default value: "unlimited".

* *

Lifecycle: this setting can be set and changed at any time. * If the internal model is not empty when this method is called, it will cause * the immediate adjustment of the rows to reflect the change. Moreover, * if applicable, the current logical page is automatically switched to page 1. *

* @param maxDynaRows - The maximum number of visible rows allowed, * or the string "unlimited", to mean that the grid is allowed * to grow without limits, without the need for paging (the check is case * insensitive). */ setMaxDynaRows(maxDynaRows: number): void; /** * Inquiry method that gets the maximum number of visible rows allowed * in the grid. * @returns The maximum number of visible rows allowed, or the String * "unlimited", to notify that the grid is allowed to grow * without limits. */ getMaxDynaRows(): number; /** * Operation method that shows a particular logical page in the internal model. * *

Lifecycle: once the {@link AbstractGrid#parseHtml} method has been called, * this method can be used at any time.

* @param pageNumber - The number of the logical page to be displayed. * The request is accepted even if the supplied number is higher than the * number of currently available logical pages, by displaying an empty * logical page, that may become nonempty as soon as enough rows are added * to the internal model. */ goToPage(pageNumber: number): void; /** * Inquiry method that gets the current number of nonempty logical pages * needed to show the rows in the internal model. * @returns The current number of logical pages. If pagination is not active * 1 is returned. */ getCurrentPages(): number; /** * Setter method that enables or disables the automatic adjustment of * the page or element scrollbars at each new update to focus on the most * recently updated row. * If a growing grid is included in an HTML element that declares * (and supports) the "overflow" attribute then this element may develop * a vertical scrollbar in order to contain all the rows. Also if the * container elements do not declare any "overflow" CSS property, then the * same may happen to the entire HTML page. * In such a cases new rows added to the grid (or moved due to the sort settings) * may be placed in the nonvisible part of the including element/page. *
This can be avoided by enabling the auto-scroll. In this case, * each time a row is added or updated, the scrollbar is repositioned * to show the row involved. This feature, however, should be used only * if the update rate is low or if this grid is listening to a DISTINCT * Subscription; otherwise, the automatic scrolling activity may be excessive. *
Note that in case the grid is configured in UPDATE_IS_KEY mode (that is * the default mode used when the grid is listening to a DISTINCT subscription) and * the scrollbar is moved from its automatic position, then the auto-scroll * is disabled until the scrollbar is repositioned to its former * position. This automatic interruption of the auto scrolling is not supported * on pre-webkit Opera browsers. *
The auto-scroll is performed only if single page mode is currently * used (i.e. the maximum number of visible rows is set to unlimited). * *

Default value: "OFF".

* *

Lifecycle: The auto-scroll policy can be set and changed * at any time.

* @param type - The auto-scroll policy. Permitted values are: * * @param elementId - The HTML "id" attribute of the HTML element whose scrollbar * should auto-scroll, if the type argument is "ELEMENT"; not used, * otherwise. */ setAutoScroll(type: string, elementId: string): void; /** * Adds a listener that will receive events from the DynaGrid * instance. *
The same listener can be added to several different DynaGrid * instances. * *

Lifecycle: a listener can be added at any time.

* @param listener - An object that will receive the events * as shown in the {@link DynaGridListener} interface. *
Note that the given instance does not have to implement all of the * methods of the DynaGridListener interface. In fact it may also * implement none of the interface methods and still be considered a valid * listener. In the latter case it will obviously receive no events. */ addListener(listener: DynaGridListener): void; /** * Removes a listener from the DynaGrid instance so that it * will not receive events anymore. * *

Lifecycle: a listener can be removed at any time.

* @param listener - The listener to be removed. */ removeListener(listener: DynaGridListener): void; /** * Returns an array containing the {@link DynaGridListener} instances that * were added to this client. * @returns an array containing the listeners that were added to this instance. * Listeners added multiple times are included multiple times in the array. */ getListeners(): DynaGridListener[]; /** * Operation method that is used to authorize and execute the binding of the * widget with the HTML of the page. * *

Lifecycle: This method can only be called once the HTML structure * the instance is expecting to find are ready in the DOM. * That said, it can be invoked at any time and subsequent invocations will update * the binding to the current state of the page DOM. Anyway, newly found cells * will be left empty until the next update involving them.

*/ parseHtml(): void; /** * Removes all the rows from the model and reflects the change on the view. * *

Lifecycle: once the {@link AbstractWidget#parseHtml} method has been called, * this method can be used at any time.

*/ clean(): void; } /** * Creates an object that will handle the positioning of the X axis and Y axis of * a {@link Chart} based on a few simple configuration parameters. *
Note that this listener expects to listen to only one Chart but can * correctly handle different lines as long as they can be represented on the * same scale. *
Methods from the {@link ChartListener} interface should not be called * directly on instances of this class. * @param [xSpan = 60] - The size of the X axis. The units of the value depends on * the model of the {@link Chart} instance and possibly on the parser configured on * the {@link Chart#setXAxis} method. If not specified, then 60 will be used. * @param [yPerc = 20] - A percentage that is used for the first positioning of the * Y axis: the Y axis will have as initial maximum position a value that is yPerc% * greater than the first Y position and as initial minimum position a value that * is yPerc% smaller than it. If not specified, then 20 (meaning 20%) will be used. */ export class SimpleChartListener extends ChartListener { constructor(xSpan?: number, yPerc?: number); onListenStart?(): void; /** * Event handler that is called each time that, due to an update to the internal * model of the {@link Chart} this instance is listening to, a new * {@link ChartLine} is being generated and displayed. * By implementing this method, it is possible to configure the appearance * of the new line. *
A new line can be generated only when a new row enters the * model. Moreover, based on the configuration of {@link Chart#addYAxis} a new * row in the model may generate more than one line resulting in this event being * fired more than one time for a single update. * @param key - The key associated with the row that caused the line * of this event to be generated (keys are described in {@link AbstractWidget}). * @param newChartLine - The object representing the new line that has * been generated. * @param currentX - The X-coordinate of the first point of the line * of this event. * @param currentY - The Y-coordinate of the first point of the line * of this event. */ onNewLine?(key: string, newChartLine: ChartLine, currentX: number, currentY: number): void; /** * Event handler that is called each time that, due to an update to the internal * model of the {@link Chart} this instance is listening to, one of the currently * active {@link ChartLine} is being removed. * @param key - The key associated with the row that was removed causing * this event to be fired (keys are described in {@link AbstractWidget}). * @param removedChartLine - The object representing the line that has * been removed. */ onRemovedLine?(key: string, removedChartLine: ChartLine): void; /** * Event handler that is called when a new update has been received * such that one or more points have to be added to the chart lines, * but cannot be shown because their X-coordinate value is higher than * the upper limit set for the X axis. * By implementing this event handler, the chart axis can be repositioned * through {@link Chart#positionXAxis} so that the new points can be shown * on the chart. *
Note that if a new update is received such that one or more points * have to be added to the chart lines but cannot be shown because their * X-coordinate value is lower than the lower limit set for the X axis, * then this event handler is not called, but rather the new update is * ignored. X axis limits should always be set in such a way as to avoid * this case. * @param key - The key associated with the row that during its update * made the overflow happen. * @param lastX - The X-coordinate value of the new points to be * shown on the chart and that exceeds the current upper limit. * @param xMin - The current lower limit for the visible part * of the X axis. * @param xMax - The current upper limit for the visible part * of the X axis. */ onXOverflow?(key: string, lastX: number, xMin: number, xMax: number): void; /** * Event handler that is called when a new update has been received * such that a new point for this line has to be added to the chart, * but cannot be shown because its Y-coordinate value is higher than * the upper limit set for the Y axis on this line, or lower than the * lower limit. * By implementing this event handler, the line can be repositioned * through {@link ChartLine#positionYAxis} so that the new point can be shown * on the chart. * @param key - The key associated with the row that during its update * made the overflow happen. * @param toUpdateChartLine - The object representing the line that * made the overflow happen. * @param lastY - The Y-coordinate value of the new point to be * shown on the chart and that exceeds the current upper or lower limit. * @param yMin - The current lower limit for the visible part * of the Y axis. * @param yMax - The current upper limit for the visible part * of the Y axis. */ onYOverflow?(key: string, toUpdateChartLine: ChartLine, lastY: number, yMin: number, yMax: number): void; } /** * Creates an object that extends {@link AbstractGrid} displaying its values * in a grid made of HTML elements. The grid rows are displayed into statically * prepared HTML rows. The object can be supplied to * {@link Subscription#addListener} and {@link Subscription#removeListener} * in order to display data from one or more Subscriptions. * @param id - An identification string to be specified in the HTML element * as the data "data-grid" property * value to make it possible for this StaticGrid instance to recognize its cells. * The binding between the cells and the StaticGrid is performed during the * {@link AbstractGrid#parseHtml} execution. * @param autoParse - If true the {@link AbstractGrid#parseHtml} method is executed * before the constructor execution is completed. If false the parseHtml method * has to be called later by custom code. It can be useful to set this flag * to false if, at the time of the StaticGrid instance creation, the HTML elements * designated as cells are not yet ready on the page. * @param rootEl - if specified, the cells to make up the HTML grid will * only be searched in the list of descendants of this node. Equivalent to a * {@link StaticGrid#setRootNode} call, but useful if autoParse is true. * @param cells - an array of DOMElement instances that will make up the * HTML grid for this StaticGrid instance. If specified and not empty, the parseHtml * method will avoid searching cells in the DOM of the page. Equivalent to multiple * {@link StaticGrid#addCell} calls, but also useful if autoParse is true. */ export class StaticGrid extends AbstractGrid { constructor(id: string, autoParse: boolean, rootEl: any, cells: object[]); /** * Operation method that adds an HTML cell pointer to the StaticGrid. *
Note that if at least one cell is manually specified then the * {@link AbstractGrid#parseHtml} will not perform any search in the DOM of the page * and will only use the given cells. * *

Lifecycle: Cell pointers can be added to a StaticGrid at any time. * However, before an HTML element is actually used as a cell by the StaticGrid * a call to {@link AbstractGrid#parseHtml} is necessary.

* @param cellElement - A DOM pointer to an HTML node. * The specified HTML node should be a "legal" cell for the StaticGrid * (i.e. should be defined according with the requirements for the * StaticGrid as described in the overview of this class). Moreover, * nodes of any types are allowed. */ addCell(cellElement: any): void; /** * Setter method that specifies the root node to be used when searching for * grid cells. If specified, only descendants of the supplied node will * be checked. *
Anyway note that if nodes are explicitly set through the constructor or through * the {@link StaticGrid#addCell} method, then the search will not be performed at all. * *

Default value: the entire document.

* *

Lifecycle: a root node can be specified at any time. * However, before a new search is performed for the StaticGrid * a call to {@link AbstractGrid#parseHtml} is necessary.

* @param rootNode - a DOM node to be used as starting point * when searching for grid cells. */ setRootNode(rootNode: any): void; /** * Creates an array containing all of the unique values of the "data-item" * properties in all of the HTML elements associated to this grid during the * {@link AbstractGrid#parseHtml} execution. * The result of this method is supposed to be used as "Item List" of a Subscription. * *
Execution of this method is pointless if HTML elements associated to this * grid through "data-item" specify an item position instead of an item name. * @returns The list of unique values found in the "data-item" properties * of HTML element of this grid. */ extractItemList(): String[]; /** * Adds a listener that will receive events from the StaticGrid * instance. *
The same listener can be added to several different StaticGrid * instances. * *

Lifecycle: a listener can be added at any time.

* @param listener - An object that will receive the events * as shown in the {@link StaticGridListener} interface. *
Note that the given instance does not have to implement all of the * methods of the StaticGridListener interface. In fact it may also * implement none of the interface methods and still be considered a valid * listener. In the latter case it will obviously receive no events. */ addListener(listener: StaticGridListener): void; /** * Removes a listener from the StaticGrid instance so that it * will not receive events anymore. * *

Lifecycle: a listener can be removed at any time.

* @param listener - The listener to be removed. */ removeListener(listener: StaticGridListener): void; /** * Returns an array containing the {@link StaticGridListener} instances that * were added to this client. * @returns an array containing the listeners that were added to this instance. * Listeners added multiple times are included multiple times in the array. */ getListeners(): StaticGridListener[]; /** * Operation method that is used to authorize and execute the binding of the * widget with the HTML of the page. * *

Lifecycle: This method can only be called once the HTML structure * the instance is expecting to find are ready in the DOM. * That said, it can be invoked at any time and subsequent invocations will update * the binding to the current state of the page DOM. Anyway, newly found cells * will be left empty until the next update involving them.

*/ parseHtml(): void; } /** * Creates an object to be used to listen to events from a * {@link LightstreamerClient} instance. * The new object will create a small visual widget to display the status of * the connection. * The created widget will have a fixed position so that it will not move * when the page is scrolled. * @param attachToBorder - "left" "right" or "no" to specify if the generated * widget should be attached to the left border, right border or should not be * attached to any border. In the latter case, it should be immediately positioned * manually, by acting on the DOM element obtained through {@link StatusWidget#getDomNode}. * @param distance - The distance of the widget from the top/bottom (depending * on the fromTop parameter). The specified distance must also contain the units * to be used: all and only the units supported by CSS are accepted. * @param fromTop - true or false to specify if the distance is related * to the top or to the bottom of the page. * @param [initialDisplay] - "open" "closed" or "dyna" to specify if the generated * widget should be initialized open, closed or, in the "dyna" case, open and then * immediately closed. By default "dyna" is used. * If attachToBorder is set to "no" then this setting has no effects. */ export class StatusWidget extends ClientListener { constructor(attachToBorder: string, distance: string, fromTop: boolean, initialDisplay?: string); /** * Inquiry method that gets the DOM element that makes the widget container. * It may be necessary to extract it to specify some extra styles or to position * it in case "no" was specified as the attachToBorder constructor parameter. * @returns The widget DOM element. */ getDomNode(): any; /** * Event handler that receives a notification each time the LightstreamerClient * status has changed. The status changes may be originated either by custom * actions (e.g. by calling {@link LightstreamerClient#disconnect}) or by * internal actions. *

The normal cases are the following: * *
Possible special cases are the following: * * *
By setting a custom handler it is possible to perform * actions related to connection and disconnection occurrences. Note that * {@link LightstreamerClient#connect} and {@link LightstreamerClient#disconnect}, * as any other method, can be issued directly from within a handler. * @param chngStatus - The new status. It can be one of the * following values: * */ onStatusChange(chngStatus: string): void; /** * Event handler that receives a notification when the ClientListener instance * is added to a LightstreamerClient through * {@link LightstreamerClient#addListener}. * This is the first event to be fired on the listener. */ onListenStart(): void; /** * Event handler that receives a notification when the ClientListener instance * is removed from a LightstreamerClient through * {@link LightstreamerClient#removeListener}. * This is the last event to be fired on the listener. */ onListenEnd(): void; } /** * This is a dummy constructor not to be used in any case. */ export class ChartListener { constructor(); /** * Event handler that is called each time that, due to an update to the internal * model of the {@link Chart} this instance is listening to, a new * {@link ChartLine} is being generated and displayed. * By implementing this method, it is possible to configure the appearance * of the new line. *
A new line can be generated only when a new row enters the * model. Moreover, based on the configuration of {@link Chart#addYAxis} a new * row in the model may generate more than one line resulting in this event being * fired more than one time for a single update. * @param key - The key associated with the row that caused the line * of this event to be generated (keys are described in {@link AbstractWidget}). * @param newChartLine - The object representing the new line that has * been generated. * @param currentX - The X-coordinate of the first point of the line * of this event. * @param currentY - The Y-coordinate of the first point of the line * of this event. */ onNewLine?(key: string, newChartLine: ChartLine, currentX: number, currentY: number): void; /** * Event handler that is called each time that, due to an update to the internal * model of the {@link Chart} this instance is listening to, one of the currently * active {@link ChartLine} is being removed. * @param key - The key associated with the row that was removed causing * this event to be fired (keys are described in {@link AbstractWidget}). * @param removedChartLine - The object representing the line that has * been removed. */ onRemovedLine?(key: string, removedChartLine: ChartLine): void; /** * Event handler that is called when a new update has been received * such that one or more points have to be added to the chart lines, * but cannot be shown because their X-coordinate value is higher than * the upper limit set for the X axis. * By implementing this event handler, the chart axis can be repositioned * through {@link Chart#positionXAxis} so that the new points can be shown * on the chart. *
Note that if a new update is received such that one or more points * have to be added to the chart lines but cannot be shown because their * X-coordinate value is lower than the lower limit set for the X axis, * then this event handler is not called, but rather the new update is * ignored. X axis limits should always be set in such a way as to avoid * this case. * @param key - The key associated with the row that during its update * made the overflow happen. * @param lastX - The X-coordinate value of the new points to be * shown on the chart and that exceeds the current upper limit. * @param xMin - The current lower limit for the visible part * of the X axis. * @param xMax - The current upper limit for the visible part * of the X axis. */ onXOverflow?(key: string, lastX: number, xMin: number, xMax: number): void; /** * Event handler that is called when a new update has been received * such that a new point for this line has to be added to the chart, * but cannot be shown because its Y-coordinate value is higher than * the upper limit set for the Y axis on this line, or lower than the * lower limit. * By implementing this event handler, the line can be repositioned * through {@link ChartLine#positionYAxis} so that the new point can be shown * on the chart. * @param key - The key associated with the row that during its update * made the overflow happen. * @param toUpdateChartLine - The object representing the line that * made the overflow happen. * @param lastY - The Y-coordinate value of the new point to be * shown on the chart and that exceeds the current upper or lower limit. * @param yMin - The current lower limit for the visible part * of the Y axis. * @param yMax - The current upper limit for the visible part * of the Y axis. */ onYOverflow?(key: string, toUpdateChartLine: ChartLine, lastY: number, yMin: number, yMax: number): void; } /** * This is a dummy constructor not to be used in any case. */ export class DynaGridListener { constructor(); /** * Event handler that receives the notification that the number of * logical pages has changed. The number of logical pages can grow or * shrink because of addition or removal of rows and because of changes * in the logical page size setting. * By implementing this method it is possible, for example, to implement * a dynamic page index to allow direct jump to each logical page. * @param numPages - The current total number of logical pages. */ onCurrentPagesChanged?(numPages: number): void; /** * Event handler that is called by Lightstreamer each time a row of the * grid is being added or modified. * By implementing this method, it is possible to perform custom * formatting on the field values, to set the cells stylesheets and to * control the display policy. * In addition, through a custom handler, it is possible to perform custom * display actions for the row, by directly acting on the DOM element * containing the grid row. *
This event is also fired when a row is being removed from the grid, * to allow clearing actions related to custom display actions previously * performed for the row. Row removal may happen when the {@link DynaGrid} * is listening to events from {@link Subscription} instance(s), and the first * Subscription it listens to is a COMMAND Subscription; * removal may also happen in case of {@link AbstractWidget#removeRow} or * {@link AbstractWidget#clean} execution and in case of destruction of * a row caused by exceeding the maximum allowed number of rows (see * {@link DynaGrid#setMaxDynaRows}). *
*
This event is fired before the update is applied to both the HTML cells * of the grid and the internal model. As a consequence, through * {@link AbstractWidget#updateRow}, it is still possible to modify the current update. *
This notification is unrelated to paging activity. New or changed * rows are notified regardless that they are being shown in the current * page or that they are currently hidden. Also, no notifications are * available to signal that a row is entering or exiting the currently * displayed page. * @param key - the key associated with the row that is being * added/removed/updated (keys are described in {@link AbstractWidget}). * @param visualUpdate - a value object containing the * updated values for all the cells, together with their display settings. * The desired settings can be set in the object, to substitute the default * settings, before returning. *
visualUpdate can also be null, to notify a clearing action. * In this case, the row is being removed from the page. * @param domNode - The DOM pointer to the HTML row involved. * The row element has been created by Lightstreamer, by cloning the * template row supplied to the {@link DynaGrid}. */ onVisualUpdate?(key: string, visualUpdate: VisualUpdate, domNode: any): void; } /** * This is a dummy constructor not to be used in any case. */ export class StaticGridListener { constructor(); /** * Event handler that is called by Lightstreamer each time a row of the * underlying model is added or modified and the change is going to be * applied to the corresponding cells in the grid. * By implementing this method, it is possible to perform custom * formatting on the field values, to set the cell stylesheets and to * control the display policy. * In addition, through a custom handler it is possible to perform custom * display actions for the row. *
Note that the availability of cells currently associated to the row * fields depends on how the StaticGrid was configured. *
This event is also fired when a row is removed from the model, * to allow clearing actions related to custom display actions previously * performed for the row. Row removal may happen when the {@link StaticGrid} * is listening to events from {@link Subscription} instance(s), and the first * Subscription it listens to is a COMMAND or a DISTINCT Subscription; * removal may also happen in case of {@link AbstractWidget#removeRow} or * {@link AbstractWidget#clean} execution. *
On the other hand, in case the row is just repositioned on the grid * no notification is supplied, but the formatting and style are kept for * the new cells. *
This event is fired before the update is applied to both the HTML cells * of the grid and the internal model. As a consequence, through * {@link AbstractWidget#updateRow} it is still possible to modify the current update. * @param key - the key associated with the row that is being * added/removed/updated (keys are described in {@link AbstractWidget}). * @param visualUpdate - a value object containing the * updated values for all the cells, together with their display settings. * The desired settings can be set in the object, to substitute the default * settings, before returning. *
visualUpdate can also be null, to notify a clearing action. * In this case, the row is being removed from the page. * @param position - the value of the data-row or data-item * value of the cells targeted by this update. */ onVisualUpdate?(key: string, visualUpdate: VisualUpdate, position: string): void; } /** * Used by LightstreamerClient to provide an extra connection properties data object. */ export class ConnectionOptions { constructor(); /** * Setter method that sets the length in bytes to be used by the Server for the * response body on a stream connection (a minimum length, however, is ensured * by the server). After the content length exhaustion, the connection will be * closed and a new bind connection will be automatically reopened. *
NOTE that this setting only applies to the "HTTP-STREAMING" case (i.e. not to WebSockets). * *

Default value: A length decided by the library, to ensure * the best performance. It can be of a few MB or much higher, depending on the environment.

* *

Lifecycle: The content length should be set before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next streaming connection (either a bind * or a brand new session).

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "contentLength" on any * {@link ClientListener} * .

* @param contentLength - The length to be used by the Server for the * response body on a HTTP stream connection. */ setContentLength(contentLength: number): void; /** * Inquiry method that gets the length expressed in bytes to be used by the Server * for the response body on a HTTP stream connection. * @returns the length to be used by the Server * for the response body on a HTTP stream connection */ getContentLength(): number; /** * 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: 19000 (19 seconds).

* *

Lifecycle: The idle timeout should be set before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next polling request.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "idleTimeout" on any * {@link ClientListener} * .

* @param idleTimeout - The time (in milliseconds) the Server is * allowed to wait for data to send upon polling requests. */ setIdleTimeout(idleTimeout: number): void; /** * 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. */ getIdleTimeout(): number; /** * 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. * If 0 is specified, the interval will be decided by the Server. * *

Default value: 0 (meaning that the Server * will send keepalive packets based on its own configuration).

* *

Lifecycle: The keepalive interval should be set before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next streaming connection (either a bind * or a brand new session). *
Note that, after a connection, * the value may be changed to the one imposed by the Server.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "keepaliveInterval" on any * {@link ClientListener} * .

* @param keepaliveInterval - The time, expressed in milliseconds, * between two keepalive packets, or 0. */ setKeepaliveInterval(keepaliveInterval: number): void; /** * 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. *
If the value has just been set and a connection to Lightstreamer * Server has not been established yet, the returned value is the time that * is being requested to the Server. Afterwards, the returned value is the time * used by the Server, that may be different, because of Server side constraints. * If the returned value is 0, it means that the interval is to be decided * by the Server upon the next connection. * @returns The time, expressed in milliseconds, between two keepalive * packets sent by the Server, or 0. */ getKeepaliveInterval(): number; /** * Setter method that sets the maximum bandwidth expressed in kilobits/s 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: Bandwidth Control is * an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the * Monitoring Dashboard (by default, available at /dashboard).

* *

Default value: "unlimited".

* *

Lifecycle: The bandwidth limit can be set and changed at any time. If a connection is currently active, the bandwidth * limit for the connection is changed on the fly. Remember that the Server may apply a different limit. * *

Notification: A change to this setting will be notified through a call to * {@link ClientListener#onPropertyChange} with argument "requestedMaxBandwidth" on any * {@link ClientListener} * . *
* Moreover, upon any change or attempt to change the limit, the Server will notify the client * and such notification will be received through a call to * {@link ClientListener#onPropertyChange} with argument "realMaxBandwidth" on any * {@link ClientListener} * .

* @param maxBandwidth - A decimal number, which represents 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 entirely decided on the Server side (the check is case insensitive). */ setRequestedMaxBandwidth(maxBandwidth: number): void; /** * Inquiry method that gets the maximum bandwidth that can be consumed for the data coming from * Lightstreamer Server, as requested for this session. * The maximum bandwidth limit really applied by the Server on the session is provided by * {@link ConnectionOptions#getRealMaxBandwidth} * @returns A decimal number, which represents the maximum bandwidth requested for the streaming * or polling connection expressed in kbps (kilobits/sec), or the string "unlimited". */ getRequestedMaxBandwidth(): number | string; /** * Inquiry method that gets the maximum bandwidth that can be consumed for the data coming from * Lightstreamer Server. This is the actual maximum bandwidth, in contrast with the requested * maximum bandwidth, returned by {@link ConnectionOptions#getRequestedMaxBandwidth}.
* The value may differ from the requested one because of restrictions operated on the server side, * or because bandwidth management is not supported (in this case it is always "unlimited"), * but also because of number rounding. * *

Lifecycle:IIf a connection to Lightstreamer Server is not currently active, null is returned; * soon after the connection is established, the value will become available.

* *

Notification: A change to this setting will be notified through a call to * {@link ClientListener#onPropertyChange} with argument "realMaxBandwidth" on any * ClientListener listening to the related LightstreamerClient. *

* @returns A decimal number, which represents the maximum bandwidth applied by the Server for the * streaming or polling connection expressed in kbps (kilobits/sec), or the string "unlimited", or null. */ getRealMaxBandwidth(): number | string; /** * Setter method that sets the polling interval used for polling * connections. The client switches from the default streaming mode * to polling mode when the client network infrastructure does not allow * streaming. Also, polling mode can be forced * by calling {@link ConnectionOptions#setForcedTransport} with * "WS-POLLING" or "HTTP-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 information. * * *

Default value: 0 (pure "asynchronous polling" is configured). *

* *

Lifecycle:The polling interval should be set before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next polling request. *
Note that, after each polling request, the value may be * changed to the one imposed by the Server.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "pollingInterval" on any * {@link ClientListener} *

* @param pollingInterval - The time (in milliseconds) between * subsequent polling requests. Zero is a legal value too, meaning that * the client will issue a new polling request as soon as * a previous one has returned. */ setPollingInterval(pollingInterval: number): void; /** * Inquiry method that gets the polling interval used for polling * connections. *
If the value has just been set and a polling request to Lightstreamer * Server has not been performed yet, the returned value is the polling interval that is being requested * to the Server. Afterwards, the returned value is the the time between * subsequent polling requests that is really allowed by the Server, that may be * different, because of Server side constraints. * @returns The time (in milliseconds) between subsequent polling requests. */ getPollingInterval(): number; /** * Setter method that sets the time the client, after entering "STALLED" status, * is allowed to keep waiting for a keepalive packet or any data on a stream connection, * before disconnecting and trying to reconnect to the Server. * The new connection may be either the opening of a new session or an attempt to recovery * the current session, depending on the kind of interruption. * *

Default value: 3000 (3 seconds).

* *

Lifecycle: This value can be set and changed at any time.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "reconnectTimeout" on any * {@link ClientListener} * .

* @param reconnectTimeout - The idle time (in milliseconds) * allowed in "STALLED" status before trying to reconnect to the * Server. */ setReconnectTimeout(reconnectTimeout: number): void; /** * Inquiry method that gets the time the client, after entering "STALLED" status, * is allowed to keep waiting 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" * status before trying to reconnect to the Server. */ getReconnectTimeout(): number; /** * Setter method that sets the extra time the client 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.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "stalledTimeout" on any * {@link ClientListener} * .

* @param stalledTimeout - The idle time (in milliseconds) * allowed before entering the "STALLED" status. */ setStalledTimeout(stalledTimeout: number): void; /** * Inquiry method that gets the extra time the client 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" status. */ getStalledTimeout(): number; /** * Setter method that sets *
    *
  1. the minimum time to wait before trying a new connection * to the Server in case the previous one failed for any reason; and
  2. *
  3. the maximum time to wait for a response to a request * before dropping the connection and trying with a different approach.
  4. *
* *

* Enforcing a delay between reconnections prevents strict loops of connection attempts when these attempts * always fail immediately because of some persisting issue. * This applies both to reconnections aimed at opening a new session and to reconnections * aimed at attempting a recovery of the current session.
* Note that the delay is calculated from the moment the effort to create a connection * is made, not from the moment the failure is detected. * As a consequence, when a working connection is interrupted, this timeout is usually * already consumed and the new attempt can be immediate (except that * {@link ConnectionOptions#setFirstRetryMaxDelay} will apply in this case). * As another consequence, when a connection attempt gets no answer and times out, * the new attempt will be immediate. * *

* As a timeout on unresponsive connections, it is applied in these cases: *

* *

* This setting imposes only a minimum delay. In order to avoid network congestion, the library may use a longer delay if the issue preventing the * establishment of a session persists. * *

Default value: 4000 (4 seconds).

* *

Lifecycle: This value can be set and changed at any time.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "retryDelay" on any * {@link ClientListener} * .

* @param retryDelay - The time (in milliseconds) * to wait before trying a new connection. */ setRetryDelay(retryDelay: number): void; /** * Inquiry method that gets the minimum time to wait before trying a new connection * to the Server in case the previous one failed for any reason, which is also the maximum time to wait for a response to a request * before dropping the connection and trying with a different approach. * Note that the delay is calculated from the moment the effort to create a connection * is made, not from the moment the failure is detected or the connection timeout expires. * @returns The time (in milliseconds) to wait before trying a new connection. */ getRetryDelay(): number; /** * Setter method that sets the maximum time to wait before trying a new connection to the Server * in case the previous one is unexpectedly closed while correctly working. * The new connection may be either the opening of a new session or an attempt to recovery * the current session, depending on the kind of interruption. *
The actual delay is a randomized value between 0 and this value. * This randomization might help avoid a load spike on the cluster due to simultaneous reconnections, should one of * the active servers be stopped. Note that this delay is only applied before the first reconnection: should such * reconnection fail, only the setting of {@link ConnectionOptions#setRetryDelay} will be applied. * *

Default value: 100 (0.1 seconds).

* *

Lifecycle: This value can be set and changed at any time.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "firstRetryMaxDelay" on any * {@link ClientListener} * .

* @param firstRetryMaxDelay - The max time (in milliseconds) * to wait before trying a new connection. */ setFirstRetryMaxDelay(firstRetryMaxDelay: number): void; /** * Inquiry method that gets the maximum time to wait before trying a new connection to the Server * in case the previous one is unexpectedly closed while correctly working. * @returns The max time (in milliseconds) * to wait before trying a new connection. */ getFirstRetryMaxDelay(): number; /** * 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, * 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. * *

Default value: false.

* *

Lifecycle:This setting should be performed before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next streaming connection (either a bind * or a brand new session).

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "slowingEnabled" on any * {@link ClientListener} * .

* @param slowingEnabled - true or false, to enable or disable * the heuristic algorithm that lowers the item update frequency. */ setSlowingEnabled(slowingEnabled: boolean): void; /** * Inquiry method that checks if the slowing algorithm is enabled or not. * @returns Whether the slowing algorithm is enabled or not. */ isSlowingEnabled(): boolean; /** * Setter method that can be used to disable/enable the * Stream-Sense algorithm and to force the client to use a fixed transport or a * fixed combination of a transport and a connection type. When a combination is specified the * Stream-Sense algorithm is completely disabled. *
The method can be used to switch between streaming and polling connection * types and between HTTP and WebSocket transports. *
In some cases, the requested status may not be reached, because of * connection or environment problems. In that case the client will continuously * attempt to reach the configured status. *
Note that if the Stream-Sense algorithm is disabled, the client may still * enter the "CONNECTED:STREAM-SENSING" status; however, in that case, * if it eventually finds out that streaming is not possible, no recovery will * be tried. * *

Default value: null (full Stream-Sense enabled).

* *

Lifecycle:This method can be called at any time. If called while * the client is connecting or connected it will instruct to switch connection * type to match the given configuration.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "forcedTransport" on any * {@link ClientListener} * .

* @param forcedTransport - can be one of the following: *
* */ setForcedTransport(forcedTransport: string): void; /** * Inquiry method that gets the value of the forced transport (if any). * @returns The forced transport or null */ getForcedTransport(): string; /** * Setter method that can be used to disable/enable the automatic handling of * server instance address that may be returned by the Lightstreamer server * during session creation. *
In fact, when a Server cluster is in place, the Server address specified * through {@link ConnectionDetails#setServerAddress} can identify various Server * instances; in order to ensure that all requests related to a session are * issued to the same Server instance, the Server can answer to the session * opening request by providing an address which uniquely identifies its own * instance. *
Setting this value to true permits to ignore that address and to always connect * through the address supplied in setServerAddress. This may be needed in a test * environment, if the Server address specified is actually a local address * to a specific Server instance in the cluster. * *

Edition Note: Server Clustering is * an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the * Monitoring Dashboard (by default, available at /dashboard).

* *

Default value: false.

* *

Lifecycle:This method can be called at any time. If called while connected, * it will be applied when the next session creation request is issued.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "serverInstanceAddressIgnored" on any * {@link ClientListener} * .

* @param serverInstanceAddressIgnored - true or false, to ignore * or not the server instance address sent by the server. */ setServerInstanceAddressIgnored(serverInstanceAddressIgnored: boolean): void; /** * Inquiry method that checks if the client is going to ignore the server * instance address that will possibly be sent by the server. * @returns Whether or not to ignore the server instance address sent by the * server. */ isServerInstanceAddressIgnored(): boolean; /** * Setter method that enables/disables the cookies-are-required policy on the * client side. * Enabling this policy will guarantee that cookies pertaining to the * Lightstreamer Server will be sent with each request. *
This holds for both cookies returned by the Server (possibly affinity cookies * inserted by a Load Balancer standing in between) and for cookies set by * other sites (for instance on the front-end page) and with a domain * specification which includes Lightstreamer Server host. * Likewise, cookies set by Lightstreamer Server and with a domain * specification which includes other sites will be forwarded to them. *
On the other hand enabling this setting may prevent the client from * opening a streaming connection or even to connect at all depending on the * browser/environment. * *

Default value: false.

* *

Lifecycle:This setting should be performed before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next HTTP request or WebSocket establishment.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "cookieHandlingRequired" on any * {@link ClientListener}.

* @param cookieHandlingRequired - true/false to enable/disable the * cookies-are-required policy. */ setCookieHandlingRequired(cookieHandlingRequired: boolean): void; /** * Inquiry method that checks if the client is going to connect only if it * can guarantee that cookies pertaining to the server will be sent. * @returns true/false if the cookies-are-required policy is enabled or not. */ isCookieHandlingRequired(): boolean; /** * Setter method that enables/disables the reverse-heartbeat mechanism * by setting the heartbeat interval. If the given value * (expressed in milliseconds) equals 0 then the reverse-heartbeat mechanism will * be disabled; otherwise if the given value is greater than 0 the mechanism * will be enabled with the specified interval. *
When the mechanism is active, the client will ensure that there is at most * the specified interval between a control request and the following one, * by sending empty control requests (the "reverse heartbeats") if necessary. *
This can serve various purposes: * *

Default value: 0 (meaning that the mechanism is disabled).

* *

Lifecycle: This setting should be performed before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the setting will be obeyed immediately, unless a higher heartbeat * frequency was notified to the Server for the current connection. The setting * will always be obeyed upon the next connection (either a bind or a brand new session).

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "reverseHeartbeatInterval" on any * {@link ClientListener} * .

* @param reverseHeartbeatInterval - the interval, expressed in milliseconds, * between subsequent reverse-heartbeats, or 0. */ setReverseHeartbeatInterval(reverseHeartbeatInterval: number): void; /** * Inquiry method that gets the reverse-heartbeat interval expressed in * milliseconds. * A 0 value is possible, meaning that the mechanism is disabled. * @returns the reverse-heartbeat interval, or 0. */ getReverseHeartbeatInterval(): number; /** * Setter method that enables/disables the setting of extra HTTP headers to all the * request performed to the Lightstreamer server by the client. * Note that when the value is set WebSockets are disabled * (as the current browser client API does not support the setting of custom HTTP headers) * unless {@link ConnectionOptions#setHttpExtraHeadersOnSessionCreationOnly} * is set to true. *
Also note that * if the browser/environment does not have the possibility to send extra headers while * some are specified through this method it will fail to connect. * Also note that the Content-Type header is reserved by the client library itself, * while other headers might be refused by the browser/environment and others might cause the * connection to the server to fail. *
For instance, you cannot use this method to specify custom cookies to be sent to * Lightstreamer Server. They can only be set and inquired through the browser's * document.cookie object.
* The use of custom headers might also cause the * browser/environment to send an OPTIONS request to the server before opening the actual connection. * Finally, note that, in case of cross-origin requests, extra headers have to be authorized * on the server configuration file, in the cross_domain_policy element. * *

Default value: null (meaning no extra headers are sent).

* *

Lifecycle:This setting should be performed before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next HTTP request or WebSocket establishment.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "httpExtraHeaders" on any * {@link ClientListener} * .

* @param headersObj - a JSON object containing header-name header-value pairs. * Null can be specified to avoid extra headers to be sent. */ setHttpExtraHeaders(headersObj: any): void; /** * Inquiry method that gets the JSON object containing the extra headers * to be sent to the server. * @returns the JSON object containing the extra headers * to be sent */ getHttpExtraHeaders(): any; /** * Setter method that enables/disables a restriction on the forwarding of the extra http headers * specified through {@link ConnectionOptions#setHttpExtraHeaders}. * If true, said headers will only be sent during the session creation process (and thus * will still be available to the Metadata Adapter notifyUser method) but will not * be sent on following requests. On the contrary, when set to false, the specified extra * headers will be sent to the server on every request * : as a consequence, if any * extra header is actually specified, WebSockets will be disabled (as the current browser * client API does not support the setting of custom HTTP headers) * . * *

Default value: false.

* *

Lifecycle:This setting should be performed before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next HTTP request or WebSocket establishment.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "httpExtraHeadersOnSessionCreationOnly" on any * {@link ClientListener} * .

* @param httpExtraHeadersOnSessionCreationOnly - true/false to enable/disable the * restriction on extra headers forwarding. */ setHttpExtraHeadersOnSessionCreationOnly(httpExtraHeadersOnSessionCreationOnly: boolean): void; /** * Inquiry method that checks if the restriction on the forwarding of the * configured extra http headers applies or not. * @returns true/false if the restriction applies or not. */ isHttpExtraHeadersOnSessionCreationOnly(): boolean; /** * Setter method that sets the maximum time allowed for attempts to recover * the current session upon an interruption, after which a new session will be created. * If the given value (expressed in milliseconds) equals 0, then any attempt * to recover the current session will be prevented in the first place. *
In fact, in an attempt to recover the current session, the client will * periodically try to access the Server at the address related with the current * session. In some cases, this timeout, by enforcing a fresh connection attempt, * may prevent an infinite sequence of unsuccessful attempts to access the Server. *
Note that, when the Server is reached, the recovery may fail due to a * Server side timeout on the retention of the session and the updates sent. * In that case, a new session will be created anyway. * A setting smaller than the Server timeouts may prevent such useless failures, * but, if too small, it may also prevent successful recovery in some cases.

* *

Default value: 15000 (15 seconds).

* *

Lifecycle: This value can be set and changed at any time.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "sessionRecoveryTimeout" on any * {@link ClientListener} * .

* @param sessionRecoveryTimeout - the maximum time allowed * for recovery attempts, expressed in milliseconds, including 0. */ setSessionRecoveryTimeout(sessionRecoveryTimeout: number): void; /** * Inquiry method that gets the maximum time allowed for attempts to recover * the current session upon an interruption, after which a new session will be created. * A 0 value also means that any attempt to recover the current session is prevented * in the first place. * @returns the maximum time allowed for recovery attempts, possibly 0. */ getSessionRecoveryTimeout(): number; } /** * Used by LightstreamerClient to provide a basic connection properties data object. */ export class ConnectionDetails { constructor(); /** * Setter method that sets the address of Lightstreamer Server. * Setting Lightstreamer Server address is not required when the front-end * pages are supplied by Lightstreamer Server itself (although this * scenario is advised only for demo purpose). * On the other hand, the setting should be configured if the front-end pages are * served by an external Web server or loaded directly from the file system or * the library is not running inside a browser. *
When the client application is downloaded from a web server, the configured * server address should have the same protocol as the client page itself. If this * requirement is not respected, the client, depending on the browser in use, * may be unable to open a streaming connection and will try to resort * to polling. *
Note that the addresses specified must always have the http: or https: scheme. * In case WebSockets are used, the specified scheme is * internally converted to match the related WebSocket protocol * (i.e. http becomes ws while https becomes wss). * *

Edition Note: HTTPS is an optional * feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the * Monitoring Dashboard (by default, available at /dashboard).

* *

Default value: the address of the server * that supplies the library pages if any, null otherwise.

* *

Lifecycle:This method can be called at any time. If called while connected, * it will be applied when the next session creation request is issued. *
This setting can also be specified in the {@link LightstreamerClient} * constructor.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "serverAddress" on any * {@link ClientListener} * .

* @param serverAddress - The full address of Lightstreamer Server. * A null value can also be used, to restore the default value. * An IPv4 or IPv6 can also be used in place of a hostname, if compatible with * the environment in use (see the notes in the summary of this documentation). * Some examples of valid values include: *
http://push.mycompany.com *
http://push.mycompany.com:8080 *
http://79.125.7.252 *
http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334] *
http://[2001:0db8:85a3::8a2e:0370:7334]:8080 */ setServerAddress(serverAddress: string): void; /** * Inquiry method that gets the configured address of Lightstreamer Server. * @returns the configured address of Lightstreamer Server. */ getServerAddress(): string; /** * Setter method that sets the name of the Adapter Set mounted on * Lightstreamer Server to be used to handle all requests in the session. *
An Adapter Set defines the Metadata Adapter and one or several * Data Adapters. It is configured on the server side through an * "adapters.xml" file; the name is configured through the "id" attribute * in the <adapters_conf> element. * *

Default value: The default Adapter Set, configured as * "DEFAULT" on the Server.

* *

Lifecycle: The Adapter Set name should be set on the * {@link LightstreamerClient#connectionDetails} object before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next time a new session is * requested to the server. *
This setting can also be specified in the {@link LightstreamerClient} * constructor.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "adapterSet" on any * {@link ClientListener} * .

* @param adapterSet - The name of the Adapter Set to be used. A null value * is equivalent to the "DEFAULT" name. */ setAdapterSet(adapterSet: string): void; /** * Inquiry method that gets the name of the Adapter Set (which defines * the Metadata Adapter and one or several Data Adapters) mounted on * Lightstreamer Server that supply all the items used in this application. * @returns the name of the Adapter Set; returns null if no name * has been configured, so that the "DEFAULT" Adapter Set is used. */ getAdapterSet(): string; /** * Setter method that sets the username to be used for the authentication * on Lightstreamer Server when initiating the push session. * The Metadata Adapter is responsible for checking the credentials * (username and password). * *

Default value: If no username is supplied, no user * information will be sent at session initiation. The Metadata Adapter, * however, may still allow the session.

* *

Lifecycle: The username should be set on the * {@link LightstreamerClient#connectionDetails} object before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next time a new session is * requested to the server.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "user" on any * {@link ClientListener} * .

* @param user - The username to be used for the authentication * on Lightstreamer Server. The username can be null. */ setUser(user: string): void; /** * Inquiry method that gets the username to be used for the authentication * on Lightstreamer Server when initiating the push session. * @returns the username to be used for the authentication * on Lightstreamer Server; returns null if no user name * has been configured. */ getUser(): string; /** * Setter method that sets the password to be used for the authentication * on Lightstreamer Server when initiating the push session. * The Metadata Adapter is responsible for checking the credentials * (username and password). * *

Default value: If no password is supplied, no password * information will be sent at session initiation. The Metadata Adapter, * however, may still allow the session.

* *

Lifecycle: The username should be set on the * {@link LightstreamerClient#connectionDetails} object before calling the * {@link LightstreamerClient#connect} method. However, the value can be changed * at any time: the supplied value will be used for the next time a new session is * requested to the server. *
NOTE: The password string will be stored as a JavaScript * variable. * That is necessary in order to allow automatic reconnection/reauthentication * for fail-over. For maximum security, avoid using an actual private * password to authenticate on Lightstreamer Server; rather use * a session-id originated by your web/application server, that can be * checked by your Metadata Adapter.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "password" on any * {@link ClientListener} * .

* @param password - The password to be used for the authentication * on Lightstreamer Server. The password can be null. */ setPassword(password: string): void; /** * Inquiry method that gets the server address to be used to issue all requests * related to the current session. In fact, when a Server cluster is in * place, the Server address specified through * {@link ConnectionDetails#setServerAddress} can identify various Server * instances; in order to ensure that all requests related to a session are * issued to the same Server instance, the Server can answer to the session * opening request by providing an address which uniquely identifies its own * instance. * When this is the case, this address is returned by the method; * otherwise, null is returned. *
Note that the addresses will always have the http: or https: scheme. * In case WebSockets are used, the specified scheme is * internally converted to match the related WebSocket protocol * (i.e. http becomes ws while https becomes wss). * *

Edition Note: Server Clustering is * an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the * Monitoring Dashboard (by default, available at /dashboard).

* *

Lifecycle: If a session is not currently active, null is returned; * soon after a session is established, the value may become available.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "serverInstanceAddress" on any * {@link ClientListener} * .

* @returns address used to issue all requests related to the current * session, or null. */ getServerInstanceAddress(): string; /** * Inquiry method that gets the instance name of the Server which is * serving the current session. To be more precise, each answering port * configured on a Server instance (through a <http_server> or * <https_server> element in the Server configuration file) can be given * a different name; the name related to the port to which the session * opening request has been issued is returned. *
Note that in case of polling or in case rebind requests are needed, * subsequent requests related to the same session may be issued to a port * different than the one used for the first request; the names configured * for those ports would not be reported. This, however, can only happen * when a Server cluster is in place and particular configurations for the * load balancer are used. * *

Edition Note: Server Clustering is * an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the * Monitoring Dashboard (by default, available at /dashboard).

* *

Lifecycle: If a session is not currently active, null is returned; * soon after a session is established, the value will become available.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "serverSocketName" on any * {@link ClientListener} * .

* @returns name configured for the Server instance which is managing the * current session, or null. */ getServerSocketName(): string; /** * Inquiry method that gets the ID associated by the server * to this client session. * *

Lifecycle: If a session is not currently active, null is returned; * soon after a session is established, the value will become available.

* *

Notification: A change to this setting will be notified through a * call to {@link ClientListener#onPropertyChange} with argument "sessionId" on any * {@link ClientListener} * .

* @returns ID assigned by the Server to this client session, or null. */ getSessionId(): string; /** * Inquiry method that gets the IP address of this client as seen by the Server which is serving * the current session as the client remote address (note that it may not correspond to the client host; * for instance it may refer to an intermediate proxy). If, upon a new session, this address changes, * it may be a hint that the intermediary network nodes handling the connection have changed, hence the network * capabilities may be different. The library uses this information to optimize the connection.
* Note that in case of polling or in case rebind requests are needed, subsequent requests related to the same * session may, in principle, expose a different IP address to the Server; these changes would not be reported. * *

Lifecycle: If a session is not currently active, null is returned; * soon after a session is established, the value may become available.

* *

Notification: A change to this setting will be notified through a call to * {@link ClientListener#onPropertyChange} with argument "clientIp" on any * ClientListener listening to the related LightstreamerClient.

* @returns A canonical representation of an IP address (it can be either IPv4 or IPv6), or null. */ getClientIp(): string; } /** * Creates an object to be configured to connect to a Lightstreamer server * and to handle all the communications with it. * It is possible to instantiate as many LightstreamerClient as needed. * Each LightstreamerClient is the entry point to connect to a Lightstreamer server, * subscribe to as many items as needed and to send messages. * @param [serverAddress] - the address of the Lightstreamer Server to * which this LightstreamerClient will connect to. It is possible not to specify * it at all or to specify it later. See {@link ConnectionDetails#setServerAddress} * for details. * @param [adapterSet] - the name of the Adapter Set mounted on Lightstreamer Server * to be used to handle all requests in the Session associated with this LightstreamerClient. * It is possible not to specify it at all or to specify it later. See * {@link ConnectionDetails#setAdapterSet} for details. */ export class LightstreamerClient { constructor(serverAddress?: string, adapterSet?: string); /** * Data object that contains options and policies for the connection to * the server. This instance is set up by the LightstreamerClient object at * its own creation. *
Properties of this object can be overwritten by values received from a * Lightstreamer Server. Such changes will be notified through a * {@link ClientListener#onPropertyChange} event on listeners of this instance. */ connectionOptions: ConnectionOptions; /** * Data object that contains the details needed to open a connection to * a Lightstreamer Server. This instance is set up by the LightstreamerClient object at * its own creation. *
Properties of this object can be overwritten by values received from a * Lightstreamer Server. Such changes will be notified through a * {@link ClientListener#onPropertyChange} event on listeners of this instance. */ connectionDetails: ConnectionDetails; /** * Static method that permits to configure the logging system used by the library. * The logging system must respect the {@link LoggerProvider} interface. A custom * class can be used to wrap any third-party JavaScript logging system. *
A ready-made LoggerProvider implementation is available within the * library in the form of the {@link SimpleLoggerProvider} class. *
If no logging system is specified, all the generated log is discarded. *
The following categories are available to be consumed: * * @param provider - A LoggerProvider instance that will be used * to generate log messages by the library classes. */ static setLoggerProvider(provider: LoggerProvider): void; /** * A constant string representing the name of the library. */ static LIB_NAME: string; /** * A constant string representing the version of the library. */ static LIB_VERSION: string; /** * Operation method that requests to open a Session against the configured * Lightstreamer Server. *
When connect() is called, unless a single transport was forced through * {@link ConnectionOptions#setForcedTransport}, * the so called "Stream-Sense" mechanism is started: if the client does not * receive any answer for some seconds from the streaming connection, then it * will automatically open a polling connection. *
A polling connection may also be opened if the environment is not suitable * for a streaming connection. *
When connect() is used to activate the Lightstreamer * Session on page start up, it is suggested to make this call as the * latest action of the scripts in the page. Otherwise, if the stream * connection is opened but third-party scripts are consuming most of the * CPU for page initialization (initial rendering, etc.), the parsing * of the streaming response could be delayed to the point that the Client * switches to polling mode. This is usually not the case nowadays but may * still happen if the client is used on old machines. *
Note that as "polling connection" we mean a loop of polling * requests, each of which requires opening a synchronous (i.e. not * streaming) connection to Lightstreamer Server. * *

Lifecycle: * Note that the request to connect is accomplished by the client * asynchronously; this means that an invocation to {@link LightstreamerClient#getStatus} * right after connect() might not reflect the change yet. Also if a * CPU consuming task is performed right after the call the connection will * be delayed. *
When the request to connect is finally being executed, if the current status * of the client is not DISCONNECTED, then nothing will be done.

*/ connect(): void; /** * Operation method that requests to close the Session opened against the * configured Lightstreamer Server (if any). *
When disconnect() is called, the "Stream-Sense" mechanism is stopped. *
Note that active {@link Subscription} instances, associated with this * LightstreamerClient instance, are preserved to be re-subscribed to on future * Sessions. * *

Lifecycle: * Note that the request to disconnect is accomplished by the client * asynchronously; this means that an invocation to {@link LightstreamerClient#getStatus} * right after disconnect() might not reflect the change yet. Also if a * CPU consuming task is performed right after the call the disconnection will * be delayed. *
When the request to disconnect is finally being executed, if the status of the client is * "DISCONNECTED", then nothing will be done.

*/ disconnect(): void; /** * Inquiry method that gets the current client status and transport * (when applicable). * @returns The current client status. It can be one of the following * values: * */ getStatus(): string; /** * Operation method that sends a message to the Server. The message is * interpreted and handled by the Metadata Adapter associated to the * current Session. This operation supports in-order guaranteed message * delivery with automatic batching. In other words, messages are * guaranteed to arrive exactly once and respecting the original order, * whatever is the underlying transport (HTTP or WebSockets). Furthermore, * high frequency messages are automatically batched, if necessary, * to reduce network round trips. *
Upon subsequent calls to the method, the sequential management of * the involved messages is guaranteed. The ordering is determined by the * order in which the calls to sendMessage are issued * . *
If a message, for any reason, doesn't reach the Server (this is possible with the HTTP transport), * it will be resent; however, this may cause the subsequent messages to be delayed. * For this reason, each message can specify a "delayTimeout", which is the longest time the message, after * reaching the Server, can be kept waiting if one of more preceding messages haven't been received yet. * If the "delayTimeout" expires, these preceding messages will be discarded; any discarded message * will be notified to the listener through {@link ClientMessageListener#onDiscarded}. * Note that, because of the parallel transport of the messages, if a zero or very low timeout is * set for a message and the previous message was sent immediately before, it is possible that the * latter gets discarded even if no communication issues occur. * The Server may also enforce its own timeout on missing messages, to prevent keeping the subsequent * messages for long time. *
Sequence identifiers 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. *
Notifications of the operation outcome can be received by supplying * a suitable listener. The supplied listener is guaranteed to be eventually * invoked; listeners associated with a sequence are guaranteed to be invoked * sequentially. *
The "UNORDERED_MESSAGES" sequence name has a special meaning. * For such a sequence, immediate processing is guaranteed, while strict * ordering and even sequentialization of the processing is not enforced. * Likewise, strict ordering of the notifications is not enforced. * However, messages that, for any reason, should fail to reach the Server * whereas subsequent messages had succeeded, might still be discarded after * a server-side timeout, in order to ensure that the listener eventually gets a notification. *
Moreover, if "UNORDERED_MESSAGES" is used and no listener is supplied, * a "fire and forget" scenario is assumed. In this case, no checks on * missing, duplicated or overtaken messages are performed at all, so as to * optimize the processing and allow the highest possible throughput. * *

Lifecycle: Since a message is handled by the Metadata * Adapter associated to the current connection, a message can be sent * only if a connection is currently active. * If the special enqueueWhileDisconnected flag is specified it is possible to * call the method at any time and the client will take care of sending the * message as soon as a connection is available, otherwise, if the current status * is "DISCONNECTED*", the message will be abandoned and the * {@link ClientMessageListener#onAbort} event will be fired. *
Note that, in any case, as soon as the status switches again to * "DISCONNECTED*", any message still pending is aborted, including messages * that were queued with the enqueueWhileDisconnected flag set to true. *
Also note that forwarding of the message to the server is made * asynchronously; this means that if a CPU consuming task is * performed right after the call, the message will be delayed. Hence, * if a message is sent while the connection is active, it could be aborted * because of a subsequent disconnection. In the same way a message sent * while the connection is not active might be sent because of a subsequent * connection.

* @param msg - a text message, whose interpretation is entirely * demanded to the Metadata Adapter associated to the current connection. * @param [sequence = "UNORDERED_MESSAGES"] - an alphanumeric identifier, used to * identify a subset of messages to be managed in sequence; underscore * characters are also allowed. If the "UNORDERED_MESSAGES" identifier is * supplied, the message will be processed in the special way described * above. *
The parameter is optional; if not supplied, "UNORDERED_MESSAGES" is used * as the sequence name. * @param [delayTimeout] - a timeout, expressed in milliseconds. * If higher than the Server configured timeout on missing messages, * the latter will be used instead.
* The parameter is optional; if not supplied, the Server configured timeout on missing * messages will be applied. *
This timeout is ignored for the special "UNORDERED_MESSAGES" sequence, * although a server-side timeout on missing messages still applies. * @param [listener] - an * object suitable for receiving notifications about the processing outcome. *
The parameter is optional; if not supplied, no notification will be * available. * @param [enqueueWhileDisconnected = false] - if this flag is set to true, and * the client is in a disconnected status when the provided message * is handled, then the message is not aborted right away but is queued waiting * for a new session. Note that the message can still be aborted later when a new * session is established. */ sendMessage(msg: string, sequence?: string, delayTimeout?: number, listener?: ClientMessageListener, enqueueWhileDisconnected?: boolean): void; /** * Inquiry method that returns an array containing all the {@link Subscription} * instances that are currently "active" on this LightstreamerClient. *
Internal second-level Subscription are not included. * @returns An array, containing all the {@link Subscription} currently * "active" on this LightstreamerClient. *
The array can be empty. */ getSubscriptions(): String[]; /** * Operation method that adds a {@link Subscription} to the list of "active" * Subscriptions. * The Subscription cannot already be in the "active" state. *
Active subscriptions are subscribed to through the server as soon as possible * (i.e. as soon as there is a session available). Active Subscription are * automatically persisted across different sessions as long as a related * unsubscribe call is not issued. * *

Lifecycle: Subscriptions can be given to the LightstreamerClient at * any time. Once done the Subscription immediately enters the "active" state. *
Once "active", a {@link Subscription} instance cannot be provided again * to a LightstreamerClient unless it is first removed from the "active" state * through a call to {@link LightstreamerClient#unsubscribe}. *
Also note that forwarding of the subscription to the server is made * asynchronously; this means that if a CPU consuming task is * performed right after the call the subscription will be delayed. *
A successful subscription to the server will be notified through a * {@link SubscriptionListener#onSubscription} event.

* @param subscription - A {@link Subscription} object, carrying * all the information needed to process its pushed values. */ subscribe(subscription: Subscription): void; /** * Operation method that removes a {@link Subscription} that is currently in * the "active" state. *
By bringing back a Subscription to the "inactive" state, the unsubscription * from all its items is requested to Lightstreamer Server. * *

Lifecycle: Subscription can be unsubscribed from at * any time. Once done the Subscription immediately exits the "active" state. *
Note that forwarding of the unsubscription to the server is made * asynchronously; this means that if a CPU consuming task is * performed right after the call the unsubscription will be delayed. *
The unsubscription will be notified through a * {@link SubscriptionListener#onUnsubscription} event.

* @param subscription - An "active" {@link Subscription} object * that was activated by this LightstreamerClient instance. */ unsubscribe(subscription: Subscription): void; /** * Adds a listener that will receive events from the LightstreamerClient * instance. *
The same listener can be added to several different LightstreamerClient * instances. * *

Lifecycle: a listener can be added at any time.

* @param listener - An object that will receive the events * as shown in the {@link ClientListener} interface. *
Note that the given instance does not have to implement all of the * methods of the ClientListener interface. In fact it may also * implement none of the interface methods and still be considered a valid * listener. In the latter case it will obviously receive no events. */ addListener(listener: ClientListener): void; /** * Removes a listener from the LightstreamerClient instance so that it * will not receive events anymore. * *

Lifecycle: a listener can be removed at any time.

* @param listener - The listener to be removed. */ removeListener(listener: ClientListener): void; /** * Returns an array containing the {@link ClientListener} instances that * were added to this client. * @returns an array containing the listeners that were added to this client. * Listeners added multiple times are included multiple times in the array. */ getListeners(): ClientListener[]; /** * Operation method that registers the MPN device on the server's MPN Module.
* By registering an MPN device, the client enables MPN functionalities such as {@link LightstreamerClient#subscribeMpn}. * *

Edition Note: MPN is an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, * available at /dashboard).

* *

Lifecycle: An {@link MpnDevice} can be registered at any time. The registration will be notified through a {@link MpnDeviceListener#onRegistered} event.

* @param device - An {@link MpnDevice} instance, carrying all the information about the MPN device. */ registerForMpn(device: any): void; /** * Operation method that subscribes an MpnSubscription on server's MPN Module.
* This operation adds the {@link MpnSubscription} to the list of "active" subscriptions. MPN subscriptions are activated on the server as soon as possible * (i.e. as soon as there is a session available and subsequently as soon as the MPN device registration succeeds). Differently than real-time subscriptions, * MPN subscriptions are persisted on the server's MPN Module database and survive the session they were created on.
* If the coalescing flag is set, the activation of two MPN subscriptions with the same Adapter Set, Data Adapter, Group, Schema and trigger expression will be * considered the same MPN subscription. Activating two such subscriptions will result in the second activation modifying the first MpnSubscription (that * could have been issued within a previous session). If the coalescing flag is not set, two activations are always considered different MPN subscriptions, * whatever the Adapter Set, Data Adapter, Group, Schema and trigger expression are set.
* The rationale behind the coalescing flag is to allow simple apps to always activate their MPN subscriptions when the app starts, without worrying if * the same subscriptions have been activated before or not. In fact, since MPN subscriptions are persistent, if they are activated every time the app starts and * the coalescing flag is not set, every activation is a new MPN subscription, leading to multiple push notifications for the same event. * *

Edition Note: MPN is an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, * available at /dashboard).

* *

Lifecycle: An MpnSubscription can be given to the LightstreamerClient once an MpnDevice registration has been requested. The MpnSubscription * immediately enters the "active" state.
* Once "active", an MpnSubscription instance cannot be provided again to an LightstreamerClient unless it is first removed from the "active" state through * a call to {@link #unsubscribeMpn}.
* A successful subscription to the server will be notified through an {@link MpnSubscriptionListener#onSubscription} event.

* @param subscription - An MpnSubscription object, carrying all the information to route real-time data via push notifications. * @param coalescing - A flag that specifies if the MPN subscription must coalesce with any pre-existing MPN subscription with the same Adapter Set, Data Adapter, * Group, Schema and trigger expression. */ subscribeMpn(subscription: any, coalescing: any): void; /** * Operation method that unsubscribes an MpnSubscription from the server's MPN Module.
* This operation removes the MpnSubscription from the list of "active" subscriptions. * *

Edition Note: MPN is an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, * available at /dashboard).

* *

Lifecycle: An MpnSubscription can be unsubscribed from at any time. Once done the MpnSubscription immediately exits the "active" state.
* The unsubscription will be notified through an {@link MpnSubscriptionListener#onUnsubscription} event.

* @param subscription - An "active" MpnSubscription object. */ unsubscribeMpn(subscription: any): void; /** * Operation method that unsubscribes all the MPN subscriptions with a specified status from the server's MPN Module.
* By specifying a status filter it is possible to unsubscribe multiple MPN subscriptions at once. E.g. by passing TRIGGERED it is possible * to unsubscribe all triggered MPN subscriptions. This operation removes the involved MPN subscriptions from the list of "active" subscriptions. * *

Edition Note: MPN is an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, * available at /dashboard).

* *

Lifecycle: Multiple unsubscription can be requested at any time. Once done the involved MPN subscriptions immediately exit the "active" state.
* The unsubscription will be notified through an {@link MpnSubscriptionListener#onUnsubscription} event to all involved MPN subscriptions.

* @param filter - A status name to be used to select the MPN subscriptions to unsubscribe. If null all existing MPN subscriptions * are unsubscribed. Possible filter values are: */ unsubscribeMpnSubscriptions(filter: any): void; /** * Inquiry method that returns a collection of the existing MPN subscription with a specified status.
* Can return both objects created by the user, via {@link MpnSubscription} constructors, and objects created by the client, to represent pre-existing MPN subscriptions.
* Note that objects in the collection may be substituted at any time with equivalent ones: do not rely on pointer matching, instead rely on the * {@link MpnSubscription#getSubscriptionId} value to verify the equivalence of two MpnSubscription objects. Substitutions may happen * when an MPN subscription is modified, or when it is coalesced with a pre-existing subscription. * *

Edition Note: MPN is an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, * available at /dashboard).

* *

Lifecycle: The collection is available once an MpnDevice registration has been requested, but reflects the actual server's collection only * after an {@link MpnDeviceListener#onSubscriptionsUpdated} event has been notified.

* @param filter - An MPN subscription status name to be used to select the MPN subscriptions to return. If null all existing MPN subscriptions * are returned. Possible filter values are: * @returns the collection of {@link MpnSubscription} with the specified status. */ getMpnSubscriptions(filter: string): MpnSubscription[]; /** * Inquiry method that returns the MpnSubscription with the specified subscription ID, or null if not found.
* The object returned by this method can be an object created by the user, via MpnSubscription constructors, or an object created by the client, * to represent pre-existing MPN subscriptions.
* Note that objects returned by this method may be substituted at any time with equivalent ones: do not rely on pointer matching, instead rely on the * {@link MpnSubscription#getSubscriptionId} value to verify the equivalence of two MpnSubscription objects. Substitutions may happen * when an MPN subscription is modified, or when it is coalesced with a pre-existing subscription. * *

Edition Note: MPN is an optional feature, available depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, * available at /dashboard).

* @param subscriptionId - The subscription ID to search for. * @returns the MpnSubscription with the specified ID, or null if not found. */ findMpnSubscription(subscriptionId: string): MpnSubscription; } /** * Creates an object to be used to describe a Subscription that is going * to be subscribed to through Lightstreamer Server. * The object can be supplied to {@link LightstreamerClient#subscribe} and * {@link LightstreamerClient#unsubscribe}, in order to bring the Subscription to * "active" or back to "inactive" state. *
Note that all of the methods used to describe the subscription to the server * can only be called while the instance is in the "inactive" state; the only * exception is {@link Subscription#setRequestedMaxFrequency}. * @param subscriptionMode - the subscription mode for the * items, required by Lightstreamer Server. Permitted values are: * * @param [items] - an array of Strings containing a list of items to * be subscribed to through the server. In case of a single-item subscription the String * containing the item name can be passed in place of the array; both of the * following examples represent a valid subscription: *
new Subscription(mode,"item1",fieldList); *
new Subscription(mode,["item1","item2"],fieldList); *
It is also possible to pass null (or nothing) and specify the * "Item List" or "Item Group" later through {@link Subscription#setItems} and * {@link Subscription#setItemGroup}. In this case the fields parameter must not be specified. * @param [fields] - An array of Strings containing a list of fields * for the items to be subscribed to through Lightstreamer Server. *
It is also possible to pass null (or nothing) and specify the * "Field List" or "Field Schema" later through {@link Subscription#setFields} and * {@link Subscription#setFieldSchema}. In this case the items parameter must not be specified. */ export class Subscription { constructor(subscriptionMode: string, items?: string | String[], fields?: String[]); /** * Inquiry method that checks if the Subscription is currently "active" or not. * Most of the Subscription properties cannot be modified if a Subscription is "active". *
The status of a Subscription is changed to "active" through the * {@link LightstreamerClient#subscribe} method and back to "inactive" through the * {@link LightstreamerClient#unsubscribe} one. * *

Lifecycle: This method can be called at any time.

* @returns true/false if the Subscription is "active" or not. */ isActive(): boolean; /** * Inquiry method that checks if the Subscription is currently subscribed to * through the server or not. *
This flag is switched to true by server sent Subscription events, and * back to false in case of client disconnection, * {@link LightstreamerClient#unsubscribe} calls and server sent unsubscription * events. * *

Lifecycle: This method can be called at any time.

* @returns true/false if the Subscription is subscribed to * through the server or not. */ isSubscribed(): boolean; /** * Setter method that sets the "Item List" to be subscribed to through * Lightstreamer Server. *
Any call to this method will override any "Item List" or "Item Group" * previously specified. * *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param items - An array of Strings containing an "Item List" to * be subscribed to through the server. */ setItems(items: String[]): void; /** * Inquiry method that can be used to read the "Item List" specified for this * Subscription. *
Note that if a single item was specified in the constructor, this method * will return an array of length 1 containing such item. * *

Lifecycle: This method can only be called if the Subscription has * been initialized with an "Item List". *

* @returns the "Item List" to be subscribed to through the server, or null if the Subscription was initialized with an "Item Group" or was not initialized at all. */ getItems(): String[]; /** * Setter method that sets the "Item Group" to be subscribed to through * Lightstreamer Server. *
Any call to this method will override any "Item List" or "Item Group" * previously specified. * *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param groupName - A String to be expanded into an item list by the * Metadata Adapter. */ setItemGroup(groupName: string): void; /** * Inquiry method that can be used to read the item group specified for this * Subscription. * *

Lifecycle: This method can only be called if the Subscription has * been initialized using an "Item Group" *

* @returns the "Item Group" to be subscribed to through the server, or null if the Subscription was initialized with an "Item List" or was not initialized at all. */ getItemGroup(): string; /** * Setter method that sets the "Field List" to be subscribed to through * Lightstreamer Server. *
Any call to this method will override any "Field List" or "Field Schema" * previously specified. * *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param fields - An array of Strings containing a list of fields to * be subscribed to through the server. */ setFields(fields: String[]): void; /** * Inquiry method that can be used to read the "Field List" specified for this * Subscription. * *

Lifecycle: This method can only be called if the Subscription has * been initialized using a "Field List". *

* @returns the "Field List" to be subscribed to through the server, or null if the Subscription was initialized with a "Field Schema" or was not initialized at all. */ getFields(): String[]; /** * Setter method that sets the "Field Schema" to be subscribed to through * Lightstreamer Server. *
Any call to this method will override any "Field List" or "Field Schema" * previously specified. * *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param schemaName - A String to be expanded into a field list by the * Metadata Adapter. */ setFieldSchema(schemaName: string): void; /** * Inquiry method that can be used to read the field schema specified for this * Subscription. * *

Lifecycle: This method can only be called if the Subscription has * been initialized using a "Field Schema" *

* @returns the "Field Schema" to be subscribed to through the server, or null if the Subscription was initialized with a "Field List" or was not initialized at all. */ getFieldSchema(): string; /** * Inquiry method that can be used to read the mode specified for this * Subscription. * *

Lifecycle: This method can be called at any time.

* @returns the Subscription mode specified in the constructor. */ getMode(): string; /** * Setter method that sets the name of the Data Adapter * (within the Adapter Set used by the current session) * that supplies all the items for this Subscription. *
The Data Adapter name is configured on the server side through * the "name" attribute of the "data_provider" element, in the * "adapters.xml" file that defines the Adapter Set (a missing attribute * configures the "DEFAULT" name). *
Note that if more than one Data Adapter is needed to supply all the * items in a set of items, then it is not possible to group all the * items of the set in a single Subscription. Multiple Subscriptions * have to be defined. * *

Default value: The default Data Adapter for the Adapter Set, * configured as "DEFAULT" on the Server.

* *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param dataAdapter - the name of the Data Adapter. A null value * is equivalent to the "DEFAULT" name. */ setDataAdapter(dataAdapter: string): void; /** * Inquiry method that can be used to read the name of the Data Adapter * specified for this Subscription through {@link Subscription#setDataAdapter}. * *

Lifecycle: This method can be called at any time.

* @returns the name of the Data Adapter; returns null if no name * has been configured, so that the "DEFAULT" Adapter Set is used. */ getDataAdapter(): string; /** * Setter method that sets the selector name for all the items in the * Subscription. The selector is a filter on the updates received. It is * executed on the Server and implemented by the Metadata Adapter. * *

Default value: null (no selector).

* *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param selector - name of a selector, to be recognized by the * Metadata Adapter, or null to unset the selector. */ setSelector(selector: string): void; /** * Inquiry method that can be used to read the selctor name * specified for this Subscription through {@link Subscription#setSelector}. * *

Lifecycle: This method can be called at any time.

* @returns the name of the selector. */ getSelector(): string; /** * Setter method that sets the maximum update frequency to be requested to * Lightstreamer Server for all the items in the Subscription. It can * be used only if the Subscription mode is MERGE, DISTINCT or * COMMAND (in the latter case, the frequency limitation applies to the * UPDATE events for each single key). For Subscriptions with two-level behavior * (see {@link Subscription#setCommandSecondLevelFields} and {@link Subscription#setCommandSecondLevelFieldSchema}) * , the specified frequency limit applies to both first-level and second-level items.
* Note that frequency limits on the items can also be set on the * server side and this request can only be issued in order to furtherly * reduce the frequency, not to rise it beyond these limits.
* This method can also be used to request unfiltered dispatching * for the items in the Subscription. However, unfiltered dispatching * requests may be refused if any frequency limit is posed on the server * side for some item. * *

Edition Note: A further global frequency limit could also * be imposed by the Server, depending on Edition and License Type; this specific limit also applies to RAW mode * and to unfiltered dispatching. * To know what features are enabled by your license, please see the License tab of the * Monitoring Dashboard (by default, available at /dashboard).

* *

Default value: null, meaning to lean on the Server default based on the subscription * mode. This consists, for all modes, in not applying any frequency * limit to the subscription (the same as "unlimited"); see the "General Concepts" * document for further details.

* *

Lifecycle: This method can can be called at any time with some * differences based on the Subscription status: *

*

* @param freq - A decimal number, representing the maximum update frequency (expressed in updates * per second) for each item in the Subscription; for instance, with a setting * of 0.5, for each single item, no more than one update every 2 seconds * will be received. If the string "unlimited" is supplied, then no frequency * limit is requested. It is also possible to supply the string * "unfiltered", to ask for unfiltered dispatching, if it is allowed for the * items, or a null value to stick to the Server default (which currently * corresponds to "unlimited"). * The check for the string constants is case insensitive. */ setRequestedMaxFrequency(freq: number): void; /** * Inquiry method that can be used to read the max frequency, configured * through {@link Subscription#setRequestedMaxFrequency}, to be requested to the * Server for this Subscription. * *

Lifecycle: This method can be called at any time.

* @returns A decimal number, representing the max frequency to be requested to the server * (expressed in updates per second), or the strings "unlimited" or "unfiltered", or null. */ getRequestedMaxFrequency(): string; /** * Setter method that sets the length to be requested to Lightstreamer * Server for the internal queueing buffers for the items in the Subscription. * A Queueing buffer is used by the Server to accumulate a burst * of updates for an item, so that they can all be sent to the client, * despite of bandwidth or frequency limits. It can be used only when the * subscription mode is MERGE or DISTINCT and unfiltered dispatching has * not been requested. Note that the Server may pose an upper limit on the * size of its internal buffers. * *

Default value: null, meaning to lean * on the Server default based on the subscription mode. This means that * the buffer size will be 1 for MERGE subscriptions and "unlimited" for * DISTINCT subscriptions. See the "General Concepts" document for further details.

* *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param size - The length of the internal queueing buffers to be * used in the Server. If the string "unlimited" is supplied, then no buffer * size limit is requested (the check is case insensitive). It is also possible * to supply a null value to stick to the Server default (which currently * depends on the subscription mode). */ setRequestedBufferSize(size: number): void; /** * Inquiry method that can be used to read the buffer size, configured though * {@link Subscription#setRequestedBufferSize}, to be requested to the Server for * this Subscription. * *

Lifecycle: This method can be called at any time.

* @returns the buffer size to be requested to the server. */ getRequestedBufferSize(): string; /** * Setter method that enables/disables snapshot delivery request for the * items in the Subscription. The snapshot can be requested only if the * Subscription mode is MERGE, DISTINCT or COMMAND. * *

Default value: "yes" if the Subscription mode is not "RAW", * null otherwise.

* *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param required - "yes"/"no" to request/not request snapshot * delivery (the check is case insensitive). If the Subscription mode is * DISTINCT, instead of "yes", it is also possible to supply a number, * to specify the requested length of the snapshot (though the length of * the received snapshot may be less than requested, because of insufficient * data or server side limits); * passing "yes" means that the snapshot length should be determined * only by the Server. Null is also a valid value; if specified no snapshot * preference will be sent to the server that will decide itself whether * or not to send any snapshot. */ setRequestedSnapshot(required: string): void; /** * Inquiry method that can be used to read the snapshot preferences, configured * through {@link Subscription#setRequestedSnapshot}, to be requested to the Server for * this Subscription. * *

Lifecycle: This method can be called at any time.

* @returns the snapshot preference to be requested to the server. */ getRequestedSnapshot(): string; /** * Setter method that sets the "Field List" to be subscribed to through * Lightstreamer Server for the second-level items. It can only be used on * COMMAND Subscriptions. *
Any call to this method will override any "Field List" or "Field Schema" * previously specified for the second-level. *
Calling this method enables the two-level behavior: *
in synthesis, each time a new key is received on the COMMAND Subscription, * the key value is treated as an Item name and an underlying Subscription for * this Item is created and subscribed to automatically, to feed fields specified * by this method. This mono-item Subscription is specified through an "Item List" * containing only the Item name received. As a consequence, all the conditions * provided for subscriptions through Item Lists have to be satisfied. The item is * subscribed to in "MERGE" mode, with snapshot request and with the same maximum * frequency setting as for the first-level items (including the "unfiltered" * case). All other Subscription properties are left as the default. When the * key is deleted by a DELETE command on the first-level Subscription, the * associated second-level Subscription is also unsubscribed from. *
Specifying null as parameter will disable the two-level behavior. * *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param fields - An array of Strings containing a list of fields to * be subscribed to through the server. *
Ensure that no name conflict is generated between first-level and second-level * fields. In case of conflict, the second-level field will not be accessible * by name, but only by position. */ setCommandSecondLevelFields(fields: String[]): void; /** * Inquiry method that can be used to read the "Field List" specified for * second-level Subscriptions. * *

Lifecycle: This method can only be called if the second-level of * this Subscription has been initialized using a "Field List" *

* @returns the list of fields to be subscribed to through the server, or null if the Subscription was initialized with a "Field Schema" or was not initialized at all. */ getCommandSecondLevelFields(): String[]; /** * Setter method that sets the "Field Schema" to be subscribed to through * Lightstreamer Server for the second-level items. It can only be used on * COMMAND Subscriptions. *
Any call to this method will override any "Field List" or "Field Schema" * previously specified for the second-level. *
Calling this method enables the two-level behavior: *
in synthesis, each time a new key is received on the COMMAND Subscription, * the key value is treated as an Item name and an underlying Subscription for * this Item is created and subscribed to automatically, to feed fields specified * by this method. This mono-item Subscription is specified through an "Item List" * containing only the Item name received. As a consequence, all the conditions * provided for subscriptions through Item Lists have to be satisfied. The item is * subscribed to in "MERGE" mode, with snapshot request and with the same maximum * frequency setting as for the first-level items (including the "unfiltered" * case). All other Subscription properties are left as the default. When the * key is deleted by a DELETE command on the first-level Subscription, the * associated second-level Subscription is also unsubscribed from. *
Specify null as parameter will disable the two-level behavior. * *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param schemaName - A String to be expanded into a field list by the * Metadata Adapter. */ setCommandSecondLevelFieldSchema(schemaName: string): void; /** * Inquiry method that can be used to read the "Field Schema" specified for * second-level Subscriptions. * *

Lifecycle: This method can only be called if the second-level of * this Subscription has been initialized using a "Field Schema". *

* @returns the "Field Schema" to be subscribed to through the server, or null if the Subscription was initialized with a "Field List" or was not initialized at all. */ getCommandSecondLevelFieldSchema(): string; /** * Setter method that sets the name of the second-level Data Adapter (within * the Adapter Set used by the current session) that supplies all the * second-level items. * All the possible second-level items should be supplied in "MERGE" mode * with snapshot available. * The Data Adapter name is configured on the server side through the * "name" attribute of the <data_provider> element, in the "adapters.xml" * file that defines the Adapter Set (a missing attribute configures the * "DEFAULT" name). * *

Default value: The default Data Adapter for the Adapter Set, * configured as "DEFAULT" on the Server.

* *

Lifecycle: This method can only be called while the Subscription * instance is in its "inactive" state.

* @param dataAdapter - the name of the Data Adapter. A null value * is equivalent to the "DEFAULT" name. */ setCommandSecondLevelDataAdapter(dataAdapter: string): void; /** * Inquiry method that can be used to read the second-level Data * Adapter name configured through {@link Subscription#setCommandSecondLevelDataAdapter}. * *

Lifecycle: This method can be called at any time.

* @returns the name of the second-level Data Adapter. */ getCommandSecondLevelDataAdapter(): string; /** * Returns the latest value received for the specified item/field pair. *
It is suggested to consume real-time data by implementing and adding * a proper {@link SubscriptionListener} rather than probing this method. * In case of COMMAND Subscriptions, the value returned by this * method may be misleading, as in COMMAND mode all the keys received, being * part of the same item, will overwrite each other; for COMMAND Subscriptions, * use {@link Subscription#getCommandValue} instead. *
Note that internal data is cleared when the Subscription is * unsubscribed from. * *

Lifecycle: This method can be called at any time; if called * to retrieve a value that has not been received yet, then it will return null. *

* @param itemIdentifier - a String representing an item in the * configured item list or a Number representing the 1-based position of the item * in the specified item group. (In case an item list was specified, passing * the item position is also possible). * @param fieldIdentifier - a String representing a field in the * configured field list or a Number representing the 1-based position of the field * in the specified field schema. (In case a field list was specified, passing * the field position is also possible). * @returns the current value for the specified field of the specified item * (possibly null), or null if no value has been received yet. */ getValue(itemIdentifier: string, fieldIdentifier: string): string; /** * Returns the latest value received for the specified item/key/field combination. * This method can only be used if the Subscription mode is COMMAND. * Subscriptions with two-level behavior are also supported, hence the specified * field can be either a first-level or a second-level one. *
It is suggested to consume real-time data by implementing and adding * a proper {@link SubscriptionListener} rather than probing this method. *
Note that internal data is cleared when the Subscription is * unsubscribed from. * *

Lifecycle: This method can be called at any time; if called * to retrieve a value that has not been received yet, then it will return null. *

* @param itemIdentifier - a String representing an item in the * configured item list or a Number representing the 1-based position of the item * in the specified item group. (In case an item list was specified, passing * the item position is also possible). * @param keyValue - a String containing the value of a key received * on the COMMAND subscription. * @param fieldIdentifier - a String representing a field in the * configured field list or a Number representing the 1-based position of the field * in the specified field schema. (In case a field list was specified, passing * the field position is also possible). * @returns the current value for the specified field of the specified * key within the specified item (possibly null), or null if the specified * key has not been added yet (note that it might have been added and eventually deleted). */ getCommandValue(itemIdentifier: string, keyValue: string, fieldIdentifier: string): string; /** * Returns the position of the "key" field in a COMMAND Subscription. *
This method can only be used if the Subscription mode is COMMAND * and the Subscription was initialized using a "Field Schema". * *

Lifecycle: This method can be called at any time.

* @returns the 1-based position of the "key" field within the "Field Schema". */ getKeyPosition(): number; /** * Returns the position of the "command" field in a COMMAND Subscription. *
This method can only be used if the Subscription mode is COMMAND * and the Subscription was initialized using a "Field Schema". * *

Lifecycle: This method can be called at any time.

* @returns the 1-based position of the "command" field within the "Field Schema". */ getCommandPosition(): number; /** * Adds a listener that will receive events from the Subscription * instance. *
The same listener can be added to several different Subscription * instances. * *

Lifecycle: a listener can be added at any time.

* @param listener - An object that will receive the events * as shown in the {@link SubscriptionListener} interface. *
Note that the given instance does not have to implement all of the * methods of the SubscriptionListener interface. In fact it may also * implement none of the interface methods and still be considered a valid * listener. In the latter case it will obviously receive no events. */ addListener(listener: SubscriptionListener): void; /** * Removes a listener from the Subscription instance so that it * will not receive events anymore. * *

Lifecycle: a listener can be removed at any time.

* @param listener - The listener to be removed. */ removeListener(listener: SubscriptionListener): void; /** * Returns an array containing the {@link SubscriptionListener} instances that * were added to this client. * @returns an Array containing the listeners that were added to this client. * Listeners added multiple times are included multiple times in the array. */ getListeners(): SubscriptionListener[]; } /** * This is a dummy constructor not to be used in any case. */ export class ConsoleLogLevel { constructor(); /** * Trace logging level. * * This level enables all logging. */ static readonly TRACE: number; /** * Debug logging level. * * This level enables all logging except tracing. */ static readonly DEBUG: number; /** * Info logging level. * * This level enables logging for information, warnings, errors and fatal errors. */ static readonly INFO: number; /** * Warn logging level. * * This level enables logging for warnings, errors and fatal errors. */ static readonly WARN: number; /** * Error logging level. * * This level enables logging for errors and fatal errors. */ static readonly ERROR: number; /** * Fatal logging level. * * This level enables logging for fatal errors only. */ static readonly FATAL: number; } /** * Creates an instance of the concrete system console logger. * @param level - The desired logging level. See {@link ConsoleLogLevel}. */ export class ConsoleLoggerProvider implements LoggerProvider { constructor(level: number); /** * Invoked to request a {@link Logger} instance that will be used for logging occurring * on the given category. It is suggested, but not mandatory, that subsequent * calls to this method related to the same category return the same {@link Logger} * instance. * @param category - the log category all messages passed to the given * Logger instance will pertain to. * @returns A Logger instance that will receive log lines related to * the given category. */ getLogger(category: string): Logger; } /** * Creates an object to be used to describe an MPN device that is going to be registered to the MPN Module of Lightstreamer Server.
* During creation the MpnDevice tries to acquires any previously registered device token from localStorage. * It then saves the current device token on localStorage. Saving and retrieving the previous device token is used to handle automatically * the cases where the token changes. The MPN Module of Lightstreamer Server is able to move * MPN subscriptions associated with the previous token to the new one. * @param token - the device token * @param appId - the application identifier * @param platform - either "Google" for Google's Firebase Cloud Messaging (FCM) or "Apple" for Apple Push Notification Service (APNs) */ export class MpnDevice { constructor(token: string, appId: string, platform: string); /** * Adds a listener that will receive events from the MpnDevice * instance. *
The same listener can be added to several different MpnDevice * instances. * *

Lifecycle: a listener can be added at any time.

* @param listener - An object that will receive the events * as shown in the {@link MpnDeviceListener} interface. *
Note that the given instance does not have to implement all of the * methods of the MpnDeviceListener interface. In fact it may also * implement none of the interface methods and still be considered a valid * listener. In the latter case it will obviously receive no events. */ addListener(listener: MpnDeviceListener): void; /** * Removes a listener from the MpnDevice instance so that it * will not receive events anymore. * *

Lifecycle: a listener can be removed at any time.

* @param listener - The listener to be removed. */ removeListener(listener: MpnDeviceListener): void; /** * Returns an array containing the {@link MpnDeviceListener} instances that * were added to this client. * @returns an Array containing the listeners that were added to this client. * Listeners added multiple times are included multiple times in the array. */ getListeners(): MpnDeviceListener[]; /** * The platform identifier of this MPN device. It equals Google or Apple and is used by the server as part of the device identification. * *

Lifecycle: This method can be called at any time.

* @returns the MPN device platform. */ getPlatform(): string; /** * The application ID of this MPN device. It is used by the server as part of the device identification. * *

Lifecycle: This method can be called at any time.

* @returns the MPN device application ID. */ getApplicationId(): string; /** * The device token of this MPN device. It is passed during creation and * is used by the server as part of the device identification. * *

Lifecycle: This method can be called at any time.

* @returns the MPN device token. */ getDeviceToken(): string; /** * The previous device token of this MPN device. It is obtained automatically from * localStorage during creation and is used by the server to restore MPN subscriptions associated with this previous token. May be null if * no MPN device has been registered yet on the application. * *

Lifecycle: This method can be called at any time.

* @returns the previous MPN device token, or null if no MPN device has been registered yet. */ getPreviousDeviceToken(): string; /** * Checks whether the MPN device object is currently registered on the server or not.
* This flag is switched to true by server sent registration events, and back to false in case of client disconnection or server sent suspension events. * *

Lifecycle: This method can be called at any time.

* @returns true if the MPN device object is currently registered on the server. */ isRegistered(): boolean; /** * Checks whether the MPN device object is currently suspended on the server or not.
* An MPN device may be suspended if errors occur during push notification delivery.
* This flag is switched to true by server sent suspension events, and back to false in case of client disconnection or server sent resume events. * *

Lifecycle: This method can be called at any time.

* @returns true if the MPN device object is currently suspended on the server. */ isSuspended(): boolean; /** * The status of the device.
* The status can be: * *

Lifecycle: This method can be called at any time.

* @returns the status of the device. */ getStatus(): string; /** * The server-side timestamp of the device status. * *

Lifecycle: This method can be called at any time.

* @returns The server-side timestamp of the device status. */ getStatusTimestamp(): number; /** * The server-side unique persistent ID of the device.
* The ID is available only after the MPN device object has been successfully registered on the server. I.e. when its status is REGISTERED or * SUSPENDED.
* Note: a device token change, if the previous device token was correctly stored on localStorage, does not cause the device ID to change: the * server moves previous MPN subscriptions from the previous token to the new one and the device ID remains unaltered. * *

Lifecycle: This method can be called at any time.

* @returns the MPN device ID. */ getDeviceId(): string; } /** * Creates an object to be used to describe an MPN subscription that is going to be subscribed to through the MPN Module of Lightstreamer Server.
* The object can be supplied to {@link LightstreamerClient#subscribeMpn} in order to bring the MPN subscription to "active" state.
* Note that all of the methods used to describe the subscription to the server can only be called while the instance is in the "inactive" state. * *

* Alternatively you can create an MpnSubscription object by passing a single argument either of type *

* @param subscriptionMode - The subscription mode for the items, required by Lightstreamer Server. Permitted values are: * @param items - An array of items to be subscribed to through Lightstreamer Server. It is also possible specify the "Item List" or * "Item Group" later through {@link MpnSubscription#setItems} and {@link MpnSubscription#setItemGroup}. * @param fields - An array of fields for the items to be subscribed to through Lightstreamer Server. It is also possible to specify the "Field List" or * "Field Schema" later through {@link MpnSubscription#setFields} and {@link MpnSubscription#setFieldSchema}. */ export class MpnSubscription { constructor(subscriptionMode: string, items: string | String[], fields: String[]); /** * Adds a listener that will receive events from the MpnSubscription * instance. *
The same listener can be added to several different MpnSubscription * instances. * *

Lifecycle: a listener can be added at any time.

* @param listener - An object that will receive the events * as shown in the {@link MpnSubscriptionListener} interface. *
Note that the given instance does not have to implement all of the * methods of the MpnSubscriptionListener interface. In fact it may also * implement none of the interface methods and still be considered a valid * listener. In the latter case it will obviously receive no events. */ addListener(listener: MpnSubscriptionListener): void; /** * Removes a listener from the MpnSubscription instance so that it * will not receive events anymore. * *

Lifecycle: a listener can be removed at any time.

* @param listener - The listener to be removed. */ removeListener(listener: MpnSubscriptionListener): void; /** * Returns an array containing the {@link MpnSubscriptionListener} instances that * were added to this client. * @returns an Array containing the listeners that were added to this client. * Listeners added multiple times are included multiple times in the array. */ getListeners(): MpnSubscriptionListener[]; /** * Inquiry method that gets the JSON structure requested by the user to be used as the format of push notifications.
* This JSON structure is sent by the server to the push notification service provider (FCM or APNs), hence it must follow * its specifications.
* @returns the JSON structure requested by the user to be used as the format of push notifications. */ getNotificationFormat(): string; /** * Inquiry method that gets the JSON structure used by the Sever to send notifications. * @returns the JSON structure used by the Server to send notifications or null if the value is not available. */ getActualNotificationFormat(): string; /** * Sets the JSON structure to be used as the format of push notifications.
* This JSON structure is sent by the server to the push notification service provider (FCM or APNs), hence it must follow * its specifications.
* The JSON structure may contain named arguments with the format ${field}, or indexed arguments with the format $[1]. These arguments are * replaced by the server with the value of corresponding subscription fields before the push notification is sent.
* For instance, if the subscription contains fields "stock_name" and "last_price", the notification format could be something like this: * Named arguments are available if the Metadata Adapter is a subclass of LiteralBasedProvider or provides equivalent functionality, otherwise only * indexed arguments may be used. In both cases common metadata rules apply: field names and indexes are checked against the Metadata Adapter, hence * they must be consistent with the schema and group specified.
* A special server-managed argument may also be used: * The MpnBuilder object provides methods to build an appropriate JSON structure from its defining fields.
* Note: if the MpnSubscription has been created by the client, such as when obtained through {@link LightstreamerClient#getMpnSubscriptions}, * named arguments are always mapped to its corresponding indexed argument, even if originally the notification format used a named argument.
* Note: the content of this property may be subject to length restrictions (See the "General Concepts" document for more information). * *

Lifecycle:This property can be changed at any time

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument notification_format on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param format - the JSON structure to be used as the format of push notifications. */ setNotificationFormat(format: string): void; /** * Inquiry method that gets the trigger expression requested by the user. * @returns returns the trigger requested by the user or null if the value is not available. */ getTriggerExpression(): string; /** * Inquiry method that gets the trigger expression evaluated by the Sever. * @returns returns the trigger sent by the Server or null if the value is not available. */ getActualTriggerExpression(): string; /** * Sets the boolean expression that will be evaluated against each update and will act as a trigger to deliver the push notification.
* If a trigger expression is set, the MPN subscription does not send any push notifications until the expression evaluates to true. When this happens, * the MPN subscription "triggers" and a single push notification is sent. Once triggered, no other push notifications are sent. In other words, with a trigger * expression set, the MPN subscription sends *at most one* push notification.
* The expression must be in Java syntax and can contain named arguments with the format ${field}, or indexed arguments with the format $[1]. * The same rules that apply to {@link MpnSubscription#setNotificationFormat} apply also to the trigger expression. The expression is verified and evaluated on the server.
* Named and indexed arguments are replaced by the server with the value of corresponding subscription fields before the expression is evaluated. They are * represented as String variables, and as such appropriate type conversion must be considered. E.g. * Argument variables are named with the prefix LS_MPN_field followed by an index. Thus, variable names like LS_MPN_field1 should be considered * reserved and their use avoided in the expression.
* Consider potential impact on server performance when writing trigger expressions. Since Java code may use classes and methods of the JDK, a badly written * trigger may cause CPU hogging or memory exhaustion. For this reason, a server-side filter may be applied to refuse poorly written (or even * maliciously crafted) trigger expressions. See the "General Concepts" document for more information.
* Note: if the MpnSubscription has been created by the client, such as when obtained through {@link LightstreamerClient#getMpnSubscriptions}, * named arguments are always mapped to its corresponding indexed argument, even if originally the trigger expression used a named argument.
* Note: the content of this property may be subject to length restrictions (See the "General Concepts" document for more information). * *

Lifecycle:This property can be changed at any time.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument trigger on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param expr - the boolean expression that acts as a trigger to deliver the push notification. If the value is null, no trigger is set on the subscription. */ setTriggerExpression(expr: string): void; /** * Checks if the MpnSubscription is currently "active" or not.
* Most of the MpnSubscription properties cannot be modified if an MpnSubscription is "active".
* The status of an MpnSubscription is changed to "active" through the {@link LightstreamerClient#subscribeMpn} method and back to "inactive" * through the {@link LightstreamerClient#unsubscribeMpn} and {@link LightstreamerClient#unsubscribeMpnSubscriptions} ones. * *

Lifecycle: This method can be called at any time.

* @returns true if the MpnSubscription is currently "active", false otherwise. */ isActive(): boolean; /** * Checks if the MpnSubscription is currently subscribed to through the server or not.
* This flag is switched to true by server sent subscription events, and back to false in case of client disconnection, * {@link LightstreamerClient#unsubscribeMpn} or {@link LightstreamerClient#unsubscribeMpnSubscriptions} calls, and server sent * unsubscription events. * *

Lifecycle: This method can be called at any time.

* @returns true if the MpnSubscription has been successfully subscribed on the server, false otherwise. */ isSubscribed(): boolean; /** * Checks if the MpnSubscription is currently triggered or not.
* This flag is switched to true when a trigger expression has been set and it evaluated to true at least once. For this to happen, the subscription * must already be in "active" and "subscribed" states. It is switched back to false if the subscription is modified with a * {@link LightstreamerClient#subscribeMpn} call on a copy of it, deleted with {@link LightstreamerClient#unsubscribeMpn} or * {@link LightstreamerClient#unsubscribeMpnSubscriptions} calls, and server sent subscription events. * *

Lifecycle: This method can be called at any time.

* @returns true if the MpnSubscription's trigger expression has been evaluated to true at least once, false otherwise. */ isTriggered(): boolean; /** * The status of the subscription.
* The status can be: * *

Lifecycle: This method can be called at any time.

* @returns the status of the subscription. */ getStatus(): string; /** * The server-side timestamp of the subscription status. * *

Lifecycle: This method can be called at any time.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument status_timestamp on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @returns The server-side timestamp of the subscription status, expressed as a Java time. */ getStatusTimestamp(): number; /** * Setter method that sets the "Item List" to be subscribed to through * Lightstreamer Server.
* Any call to this method will override any "Item List" or "Item Group" * previously specified. * *

Lifecycle: This method can only be called while the MpnSubscription * instance is in its "inactive" state.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument group on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param items - an array of items to be subscribed to through the server. */ setItems(items: String[]): void; /** * Inquiry method that can be used to read the "Item List" specified for this MpnSubscription.
* Note that if the single-item-constructor was used, this method will return an array * of length 1 containing such item.
* Note: if the MpnSubscription has been created by the client, such as when obtained through {@link LightstreamerClient#getMpnSubscriptions}, * items are always expressed with an "Item Group"", even if originally the MPN subscription used an "Item List". * *

Lifecycle: This method can only be called if the MpnSubscription has been initialized * with an "Item List".

* @returns the "Item List" to be subscribed to through the server, or null if the MpnSubscription was initialized with an "Item Group" or was not initialized at all. */ getItems(): String[]; /** * Setter method that sets the "Item Group" to be subscribed to through * Lightstreamer Server.
* Any call to this method will override any "Item List" or "Item Group" * previously specified. * *

Lifecycle: This method can only be called while the MpnSubscription * instance is in its "inactive" state.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument group on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param groupName - A String to be expanded into an item list by the * Metadata Adapter. */ setItemGroup(groupName: string): void; /** * Inquiry method that can be used to read the item group specified for this MpnSubscription.
* Note: if the MpnSubscription has been created by the client, such as when obtained through {@link LightstreamerClient#getMpnSubscriptions}, * items are always expressed with an "Item Group"", even if originally the MPN subscription used an "Item List". * *

Lifecycle: This method can only be called if the MpnSubscription has been initialized * using an "Item Group"

* @returns the "Item Group" to be subscribed to through the server, or null if the MpnSubscription was initialized with an "Item List" or was not initialized at all. */ getItemGroup(): string; /** * Setter method that sets the "Field List" to be subscribed to through * Lightstreamer Server.
* Any call to this method will override any "Field List" or "Field Schema" * previously specified. * *

Lifecycle: This method can only be called while the MpnSubscription * instance is in its "inactive" state.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument schema on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param fields - an array of fields to be subscribed to through the server. */ setFields(fields: String[]): void; /** * Inquiry method that can be used to read the "Field List" specified for this MpnSubscription.
* Note: if the MpnSubscription has been created by the client, such as when obtained through {@link LightstreamerClient#getMpnSubscriptions}, * fields are always expressed with a "Field Schema"", even if originally the MPN subscription used a "Field List". * *

Lifecycle: This method can only be called if the MpnSubscription has been initialized * using a "Field List".

* @returns the "Field List" to be subscribed to through the server, or null if the MpnSubscription was initialized with a "Field Schema" or was not initialized at all. */ getFields(): String[]; /** * Setter method that sets the "Field Schema" to be subscribed to through * Lightstreamer Server.
* Any call to this method will override any "Field List" or "Field Schema" * previously specified. * *

Lifecycle: This method can only be called while the MpnSubscription * instance is in its "inactive" state.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument schema on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param schemaName - A String to be expanded into a field list by the * Metadata Adapter. */ setFieldSchema(schemaName: string): void; /** * Inquiry method that can be used to read the field schema specified for this MpnSubscription.
* Note: if the MpnSubscription has been created by the client, such as when obtained through {@link LightstreamerClient#getMpnSubscriptions}, * fields are always expressed with a "Field Schema"", even if originally the MPN subscription used a "Field List". * *

Lifecycle: This method can only be called if the MpnSubscription has been initialized * using a "Field Schema"

* @returns the "Field Schema" to be subscribed to through the server, or null if the MpnSubscription was initialized with a "Field List" or was not initialized at all. */ getFieldSchema(): string; /** * Setter method that sets the name of the Data Adapter * (within the Adapter Set used by the current session) * that supplies all the items for this MpnSubscription.
* The Data Adapter name is configured on the server side through * the "name" attribute of the "data_provider" element, in the * "adapters.xml" file that defines the Adapter Set (a missing attribute * configures the "DEFAULT" name).
* Note that if more than one Data Adapter is needed to supply all the * items in a set of items, then it is not possible to group all the * items of the set in a single MpnSubscription. Multiple MpnSubscriptions * have to be defined. * *

Default value: The default Data Adapter for the Adapter Set, * configured as "DEFAULT" on the Server.

* *

Lifecycle: This method can only be called while the MpnSubscription * instance is in its "inactive" state.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument adapter on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param dataAdapter - the name of the Data Adapter. A null value * is equivalent to the "DEFAULT" name. */ setDataAdapter(dataAdapter: string): void; /** * Inquiry method that can be used to read the name of the Data Adapter specified for this * MpnSubscription through {@link MpnSubscription#setDataAdapter}. * *

Lifecycle: This method can be called at any time.

* @returns the name of the Data Adapter; returns null if no name has been configured, * so that the "DEFAULT" Adapter Set is used. */ getDataAdapter(): string; /** * Setter method that sets the length to be requested to Lightstreamer * Server for the internal queuing buffers for the items in the MpnSubscription.
* A Queuing buffer is used by the Server to accumulate a burst * of updates for an item, so that they can all be sent to the client, * despite of bandwidth or frequency limits.
* Note that the Server may pose an upper limit on the size of its internal buffers. * *

Default value: null, meaning to lean on the Server default based on the subscription * mode. This means that the buffer size will be 1 for MERGE * subscriptions and "unlimited" for DISTINCT subscriptions. See * the "General Concepts" document for further details.

* *

Lifecycle: This method can only be called while the MpnSubscription * instance is in its "inactive" state.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument requested_buffer_size on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param size - An integer number, representing the length of the internal queuing buffers * to be used in the Server. If the string "unlimited" is supplied, then no buffer * size limit is requested (the check is case insensitive). It is also possible * to supply a null value to stick to the Server default (which currently * depends on the subscription mode). */ setRequestedBufferSize(size: any): void; /** * Inquiry method that can be used to read the buffer size, configured though * {@link MpnSubscription#setRequestedBufferSize}, to be requested to the Server for * this MpnSubscription. * *

Lifecycle: This method can be called at any time.

* @returns An integer number, representing the buffer size to be requested to the server, * or the string "unlimited", or null. */ getRequestedBufferSize(): number | string; /** * Setter method that sets the maximum update frequency to be requested to * Lightstreamer Server for all the items in the MpnSubscription.
* Note that frequency limits on the items can also be set on the * server side and this request can only be issued in order to further * reduce the frequency, not to rise it beyond these limits. * *

Edition Note: A further global frequency limit could also be imposed by the Server, * depending on Edition and License Type. * To know what features are enabled by your license, please see the License tab of the * Monitoring Dashboard (by default, available at /dashboard).

* *

Default value: null, meaning to lean on the Server default based on the subscription * mode. This consists, for all modes, in not applying any frequency * limit to the subscription (the same as "unlimited"); see the "General Concepts" * document for further details.

* *

Lifecycle: This method can only be called while the MpnSubscription * instance is in its "inactive" state.

* *

Notification: A change to this setting will be notified through a call to {@link MpnSubscriptionListener#onPropertyChanged} * with argument requested_max_frequency on any {@link MpnSubscriptionListener} listening to the related MpnSubscription.

* @param freq - A decimal number, representing the maximum update frequency (expressed in updates * per second) for each item in the Subscription; for instance, with a setting * of 0.5, for each single item, no more than one update every 2 seconds * will be received. If the string "unlimited" is supplied, then no frequency * limit is requested. It is also possible to supply the null value to stick * to the Server default (which currently corresponds to "unlimited"). * The check for the string constants is case insensitive. */ setRequestedMaxFrequency(freq: any): void; /** * Inquiry method that can be used to read the max frequency, configured * through {@link MpnSubscription#setRequestedMaxFrequency}, to be requested to the * Server for this MpnSubscription. * *

Lifecycle: This method can be called at any time.

* @returns A decimal number, representing the max frequency to be requested to the server * (expressed in updates per second), or the string "unlimited", or null. */ getRequestedMaxFrequency(): number | string; /** * Inquiry method that can be used to read the mode specified for this * MpnSubscription. * *

Lifecycle: This method can be called at any time.

* @returns the MpnSubscription mode specified in the constructor. */ getMode(): string; /** * The server-side unique persistent ID of the MPN subscription.
* The ID is available only after the MPN subscription has been successfully subscribed on the server. I.e. when its status is SUBSCRIBED or * TRIGGERED.
* Note: more than one MpnSubscription may exists at any given time referring to the same MPN subscription, and thus with the same subscription ID. * For instance, copying an MpnSubscription with the copy initializer creates a second MpnSubscription instance with the same subscription ID. Also, * the coalescing flag of {@link LightstreamerClient#subscribeMpn} may cause the assignment of a pre-existing MPN subscription ID * to the new subscription.
* Two MpnSubscription objects with the same subscription ID always represent the same server-side MPN subscription. It is the client's duty to keep the status * and properties of these objects up to date and aligned. * *

Lifecycle: This method can be called at any time.

* @returns the MPN subscription ID. */ getSubscriptionId(): string; } /** * Creates an object to be used to create a push notification format.
* Use setters methods to set the value of push notification fields or use a JSON structure to initialize the fields. * @param [notificationFormat] - A JSON structure representing a push notification format. */ export class SafariMpnBuilder { constructor(notificationFormat?: any); /** * Produces the JSON structure for the push notification format specified by this object. * @returns the JSON structure for the push notification format. */ build(): string; /** * Gets the value of aps.alert.title field. * @returns the value of aps.alert.title field, or null if absent. */ getTitle(): string; /** * Sets the aps.alert.title field. * @param title - A string to be used for the aps.alert.title field value, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setTitle(title: string): SafariMpnBuilder; /** * Gets the value of aps.alert.body field. * @returns the value of aps.alert.body field, or null if absent. */ getBody(): string; /** * Sets the aps.alert.body field. * @param body - A string to be used for the aps.alert.body field value, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setBody(body: string): SafariMpnBuilder; /** * Gets the value of aps.alert.action field. * @returns the value of aps.alert.action field, or null if absent. */ getAction(): string; /** * Sets the aps.alert.action field. * @param action - A string to be used for the aps.alert.action field value, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setAction(action: string): SafariMpnBuilder; /** * Gets the value of aps.url-args field. * @returns the value of aps.url-args field, or null if absent. */ getUrlArguments(): String[]; /** * Sets the aps.url-args field. * @param urlArguments - An array to be used for the aps.url-args field value, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setUrlArguments(urlArguments: String[]): SafariMpnBuilder; } /** * Creates an object to be used to create a push notification format.
* Use setters methods to set the value of push notification fields or use a JSON structure to initialize the fields. * @param [notificationFormat] - A JSON structure representing a push notification format. */ export class FirebaseMpnBuilder { constructor(notificationFormat?: any); /** * Produces the JSON structure for the push notification format specified by this object. * @returns the JSON structure for the push notification format. */ build(): string; /** * Gets sub-fields of the webpush.headers field. * @returns a map with sub-fields of the webpush.headers field, or null if absent. */ getHeaders(): any; /** * Sets sub-fields of the webpush.headers field. * @param headers - map to be used for sub-fields of the webpush.headers field, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setHeaders(headers: any): FirebaseMpnBuilder; /** * Gets the value of webpush.notification.title field. * @returns the value of webpush.notification.title field, or null if absent. */ getTitle(): string; /** * Sets the webpush.notification.title field. * @param title - A string to be used for the webpush.notification.title field value, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setTitle(title: string): FirebaseMpnBuilder; /** * Gets the value of webpush.notification.body field. * @returns the value of webpush.notification.body field, or null if absent. */ getBody(): string; /** * Sets the webpush.notification.body field. * @param body - A string to be used for the webpush.notification.body field value, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setBody(body: string): FirebaseMpnBuilder; /** * Gets the value of webpush.notification.icon field. * @returns the value of webpush.notification.icon field, or null if absent. */ getIcon(): string; /** * Sets the webpush.notification.icon field. * @param icon - A string to be used for the webpush.notification.icon field value, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setIcon(icon: string): FirebaseMpnBuilder; /** * Gets sub-fields of the webpush.data field. * @returns a map with sub-fields of the webpush.data field, or null if absent. */ getData(): any; /** * Sets sub-fields of the webpush.data field. * @param data - A map to be used for sub-fields of the webpush.data field, or null to clear it. * @returns this MpnBuilder object, for fluent use. */ setData(data: any): FirebaseMpnBuilder; } /** * Callback for {@link Chart#setXLabels} and {@link ChartLine#setYLabels}. * @param value - the value to be formatted before being print in a label. * @return the String to be set as content for the label. */ declare type LabelsFormatter = (value: number) => string; /** * Callback for {@link Chart#setXAxis} and {@link Chart#addYAxis}. * @param fieldValue - the field value to be parsed. * @param key - the key associated with the given value * @return a valid number to be plotted or null if the value has to be considered unchanged */ declare type CustomParserFunction = (fieldValue: string, key: string) => number; /** * Callback for {@link VisualUpdate#forEachChangedField}. * @param field - name of the involved changed field. * @param value - the new value for the field. See {@link VisualUpdate#getChangedFieldValue} for details. * Note that changes to the values made through {@link VisualUpdate#setCellValue} calls will not be reflected * by the iterator, as they don't affect the model. */ declare type ChangedFieldCallback = (filed: string, value: string) => void; declare module 'lightstreamer-client-web';