MpnSubscription class

Class representing a Mobile Push Notifications (MPN) subscription to be submitted to the MPN Module of a Lightstreamer Server.

It contains subscription details and the listener needed to monitor its status. Real-time data is routed via native push notifications.
In order to successfully subscribe an MPN subscription, first an MpnDevice must be created and registered on the LightstreamerClient with LightstreamerClient.registerForMpn.
After creation, an MpnSubscription object is in the "inactive" state. When an MpnSubscription object is subscribed to on an LightstreamerClient object, through the LightstreamerClient.subscribe method, its state switches to "active". This means that the subscription request is being sent to the Lightstreamer Server. Once the server accepted the request, it begins to send real-time events via native push notifications and the MpnSubscription object switches to the "subscribed" state.
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 switches to "triggered" state and a single push notification is sent. Once triggered, no other push notifications are sent.
When an MpnSubscription is subscribed on the server, it acquires a permanent subscription ID that the server later uses to identify the same MPN subscription on subsequent sessions.
An MpnSubscription can be configured to use either an Item Group or an Item List to specify the items to be subscribed to, and using either a Field Schema or Field List to specify the fields. The same rules that apply to Subscription apply to MpnSubscription.
An MpnSubscription object can also be provided by the client to represent a pre-existing MPN subscription on the server. In fact, differently than real-time subscriptions, MPN subscriptions are persisted on the server's MPN Module database and survive the session they were created on.
MPN subscriptions are associated with the MPN device, and after the device has been registered the client retrieves pre-existing MPN subscriptions from the server's database and exposes them with the LightstreamerClient.getMpnSubscriptions method.

Constructors

MpnSubscription(String mode, [List<String>? items, List<String>? fields])
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.
MpnSubscription.fromMpnSubscription(MpnSubscription sub)
Creates an MPNSubscription object copying all properties from the specified MPN subscription.
MpnSubscription.fromSubscription(Subscription sub)
Creates an MpnSubscription object copying subscription mode, items, fields and data adapter from the specified real-time subscription.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(MpnSubscriptionListener listener) → void
Adds a listener that will receive events from the MpnSubscription instance.
getActualNotificationFormat() String?
Inquiry method that gets the JSON structure used by the Sever to send notifications.
getActualTriggerExpression() String?
Inquiry method that gets the trigger expression evaluated by the Sever.
getDataAdapter() String?
Inquiry method that can be used to read the name of the Data Adapter specified for this MpnSubscription through setDataAdapter.
getFields() List<String>?
Inquiry method that can be used to read the "Field List" specified for this MpnSubscription.
getFieldSchema() String?
Inquiry method that can be used to read the field schema specified for this MpnSubscription.
getItemGroup() String?
Inquiry method that can be used to read the item group specified for this MpnSubscription.
getItems() List<String>?
Inquiry method that can be used to read the "Item List" specified for this MpnSubscription.
getListeners() List<MpnSubscriptionListener>
Returns the list containing the MpnSubscriptionListener instances that were added to this MpnSubscription.
getMode() String
Inquiry method that can be used to read the mode specified for this MpnSubscription.
getNotificationFormat() String?
Inquiry method that gets the JSON structure requested by the user to be used as the format of push notifications.
getRequestedBufferSize() String?
Inquiry method that can be used to read the buffer size, configured though setRequestedBufferSize, to be requested to the Server for this MpnSubscription.
getRequestedMaxFrequency() String?
Inquiry method that can be used to read the max frequency, configured through setRequestedMaxFrequency, to be requested to the Server for this MpnSubscription.
getStatus() String
The status of the subscription.
getStatusTimestamp() int
The server-side timestamp of the subscription status.
getSubscriptionId() String?
The server-side unique persistent ID of the MPN subscription.
getTriggerExpression() String?
Inquiry method that gets the trigger expression requested by the user.
isActive() bool
Checks if the MpnSubscription is currently "active" or not.
isSubscribed() bool
Checks if the MpnSubscription is currently subscribed to through the server or not.
isTriggered() bool
Checks if the MpnSubscription is currently triggered or not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeListener(MpnSubscriptionListener listener) → void
Removes a listener from the MpnSubscription instance so that it will not receive events anymore.
setDataAdapter(String? dataAdapter) → void
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.
setFields(List<String>? fields) → void
Setter method that sets the "Field List" to be subscribed to through Lightstreamer Server.
setFieldSchema(String? schemaName) → void
Setter method that sets the "Field Schema" to be subscribed to through Lightstreamer Server.
setItemGroup(String? groupName) → void
Setter method that sets the "Item Group" to be subscribed to through Lightstreamer Server.
setItems(List<String>? items) → void
Setter method that sets the "Item List" to be subscribed to through Lightstreamer Server.
setNotificationFormat(String format) Future<void>
Sets the JSON structure to be used as the format of push notifications.
setRequestedBufferSize(String? size) → void
Setter method that sets the length to be requested to Lightstreamer Server for the internal queuing buffers for the items in the MpnSubscription.
setRequestedMaxFrequency(String? freq) → void
Setter method that sets the maximum update frequency to be requested to Lightstreamer Server for all the items in the MpnSubscription.
setTriggerExpression(String? trigger) Future<void>
Sets the boolean expression that will be evaluated against each update and will act as a trigger to deliver the push notification.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited