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.
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
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 -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Adds a listener that will receive events from the MpnSubscription instance. -
getActualNotificationFormat(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that gets the JSON structure used by the Sever to send notifications. -
getActualTriggerExpression(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that gets the trigger expression evaluated by the Sever. -
getDataAdapter(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that can be used to read the name of the Data Adapter specified for this MpnSubscription through setDataAdapter. -
getFields(
) → List< String> ? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that can be used to read the "Field List" specified for this MpnSubscription. -
getFieldSchema(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that can be used to read the field schema specified for this MpnSubscription. -
getItemGroup(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that can be used to read the item group specified for this MpnSubscription. -
getItems(
) → List< String> ? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that can be used to read the "Item List" specified for this MpnSubscription. -
getListeners(
) → List< MpnSubscriptionListener> -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Returns the list containing the MpnSubscriptionListener instances that were added to this MpnSubscription. -
getMode(
) → String -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that can be used to read the mode specified for this MpnSubscription. -
getNotificationFormat(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that gets the JSON structure requested by the user to be used as the format of push notifications. -
getRequestedBufferSize(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
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? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
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 -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
The status of the subscription. -
getStatusTimestamp(
) → int -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
The server-side timestamp of the subscription status. -
getSubscriptionId(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
The server-side unique persistent ID of the MPN subscription. -
getTriggerExpression(
) → String? -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Inquiry method that gets the trigger expression requested by the user. -
isActive(
) → bool -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Checks if the MpnSubscription is currently "active" or not. -
isSubscribed(
) → bool -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Checks if the MpnSubscription is currently subscribed to through the server or not. -
isTriggered(
) → bool -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
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 -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Removes a listener from the MpnSubscription instance so that it will not receive events anymore. -
setDataAdapter(
String? dataAdapter) → void -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
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 -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Setter method that sets the "Field List" to be subscribed to through Lightstreamer Server. -
setFieldSchema(
String? schemaName) → void -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Setter method that sets the "Field Schema" to be subscribed to through Lightstreamer Server. -
setItemGroup(
String? groupName) → void -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Setter method that sets the "Item Group" to be subscribed to through Lightstreamer Server. -
setItems(
List< String> ? items) → void -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Setter method that sets the "Item List" to be subscribed to through Lightstreamer Server. -
setNotificationFormat(
String format) → void -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Sets the JSON structure to be used as the format of push notifications. -
setRequestedBufferSize(
String? size) → void -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
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 -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
Setter method that sets the maximum update frequency to be requested to Lightstreamer Server for all the items in the MpnSubscription. -
setTriggerExpression(
String? trigger) → void -
Available on MpnSubscription, provided by the MpnSubscriptionExt extension
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