public interface MpnSubscription
MpnKey
object) and the specifications (as an MpnInfo
object) of
a mobile push notifications (MPN) subscription. It represents a view on the actual MPN subscription stored on the Server's
database. The MpnSubscription class supports operations like checking its current status, modifying the specifications and
deactivating the MPN subscription.
LSClient
instance that originated (i.e. activated or inquired) the MPN subscription.
Thus, once an MpnSubscription object, with a certain MPN key, has been obtained from an LSClient
instance, any operation returning
the same MPN subscription from the same LSClient
instance will return the same MpnSubscription instance. On the other hand,
deactivating an MPN subscription removes it from the local cache and marks its corresponding MpnSubscription instance as deactivated (see isDeactivated()
).
LSClient
local cache survives a reconnection: if the LSClient
reconnects with the same base parameters
(i.e. ConnectionInfo.pushServerUrl
, ConnectionInfo.adapter
and ConnectionInfo.user
), the MPN subscription cache is preserved. If one of
these parameters changes, the cache is cleared and any dangling MpnSubscription instance is made invalid (no more operations will be possible on it).
LSClient
, see getClient()
. In order for any operation to be successful, the
originating LSClient
must be connected at the moment the operation is executed.
MpnKey
instance is constant, the MpnInfo
instance may be replaced by calls that modify the MPN subscription's specifications,
e.g. modify(com.lightstreamer.ls_client.mpn.MpnInfo)
, or LSClient.activateMpn(com.lightstreamer.ls_client.mpn.MpnInfo, boolean)
with coalescing
flag set, or by calls that update the local cache from the Server,
e.g. LSClient.inquireMpn(MpnKey)
, LSClient.inquireMpn(MpnSubscriptionStatus)
and LSClient.inquireAllMpn()
.
Modifier and Type | Method and Description |
---|---|
MpnStatusInfo |
checkStatus()
Inquires the status of the MPN subscription on the Server.
|
void |
deactivate()
Deactivates the MPN subscription.
|
LSClient |
getClient()
The LSClient instance to that originated (i.e.
|
MpnInfo |
getMpnInfo()
The specifications of this MPN subscription.
|
MpnKey |
getMpnKey()
The MPN key identifying this MPN subscription.
|
boolean |
isDeactivated()
Tells if this MPN subscription has been deactivated or not.
|
void |
modify(MpnInfo mpnInfo)
Modifies the specifications of the MPN subscription.
|
LSClient getClient()
MpnKey getMpnKey()
MpnInfo getMpnInfo()
MpnInfo
object.
modify(com.lightstreamer.ls_client.mpn.MpnInfo)
, or LSClient.activateMpn(com.lightstreamer.ls_client.mpn.MpnInfo, boolean)
with coalescing
flag set, or by
calls that update the local cache from the Server, e.g. LSClient.inquireMpn(MpnKey)
, LSClient.inquireMpn(MpnSubscriptionStatus)
and LSClient.inquireAllMpn()
.
MpnSubscription
description for more information.boolean isDeactivated()
deactivate()
, or LSClient.deactivateMpn(com.lightstreamer.ls_client.mpn.MpnSubscriptionStatus)
and LSClient.deactivateAllMpn()
, or by
calls that update the local cache from the Server, e.g. LSClient.inquireMpn(com.lightstreamer.ls_client.mpn.MpnKey)
and LSClient.inquireAllMpn()
.
MpnSubscription
description for more information.MpnStatusInfo checkStatus() throws SubscrException, PushServerException, PushUserException, PushConnException
PushUserException
with error code 46 (subscription unknown) or 45 (device unknown, if no more subscriptions exist for this device and application).
LSClient.openConnection(com.lightstreamer.ls_client.ConnectionInfo, com.lightstreamer.ls_client.ConnectionListener)
for details on timeout settings.SubscrException
- Thrown if the connection is closed, or if the MPN subscription is known to be deactivated.PushConnException
- Thrown in case of connection problems.PushServerException
- Thrown in case of errors in Server response. In normal conditions, this exception should never happen.PushUserException
- Thrown in case the operation has been refused by the Lightstreamer Server.void modify(MpnInfo mpnInfo) throws SubscrException, PushServerException, PushUserException, PushConnException
mpnInfo
field is updated with the passed mpnInfo instance, whereas the MPN key remains unchanged.
PushUserException
with error code 46 (subscription unknown) or 45 (device unknown, if no more subscriptions exist for this device and application).
LSClient.activateMpn(com.lightstreamer.ls_client.mpn.MpnInfo, boolean)
for more information on coalescence.
LSClient.activateMpn(com.lightstreamer.ls_client.mpn.MpnInfo, boolean)
) apply during modification. Additionally,
moving MPN subscriptions from an adapter set to another is not allowed. This means the adapterSet
field of SimpleTableInfo
must be the same of the original MPN subscription AND the same of the current connection. If this field is nil, the
adapter set of the current connection is considered as specified.
MpnSubscription
description for more information.
This method always contacts the Server and updates the related MPN subscription in the local cache.
LSClient.openConnection(com.lightstreamer.ls_client.ConnectionInfo, com.lightstreamer.ls_client.ConnectionListener)
for details on timeout settings.mpnInfo
- Contains the new table and format specifications of the mobile push notifications. A copy of the object is stored internally.SubscrException
- Thrown if the connection is closed, or if the MPN subscription is known to be deactivated.PushConnException
- Thrown in case of connection problems.PushServerException
- Thrown in case of errors in Server response. In normal conditions, this exception should never happen.PushUserException
- Thrown in case the operation has been refused by the Lightstreamer Server.void deactivate() throws SubscrException, PushServerException, PushUserException, PushConnException
PushUserException
with error code 46 (subscription unknown) or 45 (device unknown, if no more subscriptions exist for this device and application).
MpnSubscription
description for more information.
This method always contacts the Server and updates the related MPN subscription in the local cache.
LSClient.openConnection(com.lightstreamer.ls_client.ConnectionInfo, com.lightstreamer.ls_client.ConnectionListener)
for details on timeout settings.SubscrException
- Thrown if the connection is closed, or if the MPN subscription is known to be deactivated.PushConnException
- Thrown in case of connection problems.PushServerException
- Thrown in case of errors in Server response. In normal conditions, this exception should never happen.PushUserException
- Thrown in case the operation has been refused by the Lightstreamer Server.