Methods
onListenEnd(subscription)
Event handler called when the MpnSubscriptionListener instance is removed from an MpnSubscription through
MpnSubscription#removeListener.
This is the last event to be fired on the listener.
Parameters:
Name | Type | Description |
---|---|---|
subscription |
MpnSubscription |
The MpnSubscription this instance was removed from. |
onListenStart(subscription)
Event handler called when the MpnSubscriptionListener instance is added to an MpnSubscription through
MpnSubscription#addListener.
This is the first event to be fired on the listener.
Parameters:
Name | Type | Description |
---|---|---|
subscription |
MpnSubscription |
The MpnSubscription this instance was added to. |
onPropertyChanged(propertyName)
Event handler called each time the value of a property of 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 LightstreamerClient#subscribeMpn).
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String |
The name of the changed property. It can be one of the following:
|
onStatusChanged(status, timestamp)
Event handler called when the server notifies that an 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.
Parameters:
Name | Type | Description |
---|---|---|
status |
String |
The new status of the MPN subscription. It can be one of the following:
|
timestamp |
Number |
The server-side timestamp of the new subscription status. |
onSubscription()
Event handler called when an 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 LightstreamerClient#unsubscribeMpn and LightstreamerClient#subscribeMpn. Two consecutive calls
to this method are not possible, as before a second onSubscription()
event an MpnSubscriptionListener#onUnsubscription event is always fired.
onSubscriptionError(code, message)
Event handler called when the server notifies an error while subscribing to an MpnSubscription.
By implementing this method it is possible to perform recovery actions.
Parameters:
Name | Type | Description |
---|---|---|
code |
Number |
The error code sent by the Server. It can be one of the following:
|
message |
String |
The description of the error sent by the Server; it can be null. |
onTriggered()
Event handler called when the server notifies that an 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 LightstreamerClient#unsubscribeMpn and 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.
onUnsubscription()
Event handler called when an MpnSubscription has been successfully unsubscribed from on the server's MPN Module.
After this call no more events can be received until a new 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 LightstreamerClient#unsubscribeMpn and LightstreamerClient#subscribeMpn. Two consecutive calls
to this method are not possible, as before a second onUnsubscription()
event an MpnSubscriptionListener#onSubscription event is always fired.
onUnsubscriptionError(code, message)
Event handler called when the server notifies an error while unsubscribing from an MpnSubscription.
By implementing this method it is possible to perform recovery actions.
Parameters:
Name | Type | Description |
---|---|---|
code |
Number |
The error code sent by the Server. It can be one of the following:
|
message |
String |
The description of the error sent by the Server; it can be null. |