LSMPNDeviceDelegate Protocol Reference

Conforms to NSObject
Declared in LSMPNDeviceDelegate.h

Overview

Protocol to be implemented to receive LSMPNDevice events including registration, suspension/resume and status change.

Events for these delegates are dispatched by a different thread than the one that generates them. This means that, upon reception of an event, it is possible that the internal state of the client has changed. On the other hand, all the notifications for a single LSLightstreamerClient, including notifications to LSClientDelegate, LSSubscriptionDelegate, LSClientMessageDelegate, LSMPNDeviceDelegate and LSMPNSubscriptionDelegate will be dispatched by the same thread.

– mpnDeviceDidAddDelegate:

Event handler called when the LSMPNDeviceDelegate instance is added to an LSMPNDevice through [LSMPNDevice addDelegate:].

This is the first event to be fired on the delegate.

- (void)mpnDeviceDidAddDelegate:(nonnull LSMPNDevice *)device

Parameters

device

The LSMPNDevice this instance was added to.

Declared In

LSMPNDeviceDelegate.h

– mpnDeviceDidRemoveDelegate:

Event handler called when the LSMPNDeviceDelegate instance is removed from an LSMPNDevice through [LSMPNDevice removeDelegate:].

This is the last event to be fired on the delegate.

- (void)mpnDeviceDidRemoveDelegate:(nonnull LSMPNDevice *)device

Parameters

device

The LSMPNDevice this instance was removed from.

Declared In

LSMPNDeviceDelegate.h

– mpnDeviceDidRegister:

Event handler called when an LSMPNDevice 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 LSMPNDevice instance in case the client disconnects and reconnects. In this case the device is registered again automatically.

- (void)mpnDeviceDidRegister:(nonnull LSMPNDevice *)device

Parameters

device

The LSMPNDevice instance involved.

Declared In

LSMPNDeviceDelegate.h

– mpnDeviceDidSuspend:

Event handler called when an LSMPNDevice 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.

- (void)mpnDeviceDidSuspend:(nonnull LSMPNDevice *)device

Parameters

device

The LSMPNDevice instance involved.

Declared In

LSMPNDeviceDelegate.h

– mpnDeviceDidResume:

Event handler called when an LSMPNDevice 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.

- (void)mpnDeviceDidResume:(nonnull LSMPNDevice *)device

Parameters

device

The LSMPNDevice instance involved.

Declared In

LSMPNDeviceDelegate.h

– mpnDevice:didFailRegistrationWithErrorCode:message:

Event handler called when the server notifies an error while registering an LSMPNDevice.

By implementing this method it is possible to perform recovery actions.

The error code can be one of the following:

  • 40 - the MPN Module is disabled, either by configuration or by license restrictions.

  • 41 - the request failed because of some internal resource error (e.g. database connection, timeout etc.).

  • 43 - invalid or unknown application ID.

  • 45 - invalid or unknown MPN device ID.

  • 48 - MPN device suspended.

  • 66 - an unexpected exception was thrown by the Metadata Adapter while authorizing the connection.

  • 68 - the Server could not fulfill the request because of an internal error.

  • <= 0 - the Metadata Adapter has refused the subscription request; the code value is dependent on the specific Metadata Adapter implementation.

- (void)mpnDevice:(nonnull LSMPNDevice *)device didFailRegistrationWithErrorCode:(NSInteger)code message:(nullable NSString *)message

Parameters

device

The LSMPNDevice instance involved.

code

The error code sent by the Server.

message

The description of the error sent by the Server; it can be nil.

Declared In

LSMPNDeviceDelegate.h

– mpnDevice:didChangeStatus:timestamp:

Event handler called when the server notifies that an LSMPNDevice changed its status.

Note that in some server clustering configurations the status change for the MPN device suspend event may not be called.

- (void)mpnDevice:(nonnull LSMPNDevice *)device didChangeStatus:(nonnull NSString *)status timestamp:(nonnull NSDate *)timestamp

Parameters

device

The LSMPNDevice instance involved.

status

The new status of the MPN device.

timestamp

The server-side timestamp of the new device status.

Declared In

LSMPNDeviceDelegate.h

– mpnDeviceDidUpdateSubscriptions:

Event handler called when the server notifies that the list of MPN subscription associated with an LSMPNDevice has been updated.

After registration, the list of pre-existing MPN subscriptions for an is updated and made available through the [LSLightstreamerClient MPNSubscriptions] property.

- (void)mpnDeviceDidUpdateSubscriptions:(nonnull LSMPNDevice *)device

Parameters

device

The LSMPNDevice instance involved.

Declared In

LSMPNDeviceDelegate.h

– mpnDeviceDidResetBadge:

Event handler called when the server notifies that the badge of an LSMPNDevice has been reset.

- (void)mpnDeviceDidResetBadge:(nonnull LSMPNDevice *)device

Parameters

device

The LSMPNDevice instance involved.

Declared In

LSMPNDeviceDelegate.h

– mpnDevice:didFailBadgeResetWithErrorCode:message:

Event handler called when the server notifies an error while resetting the badge of an LSMPNDevice.

By implementing this method it is possible to perform recovery actions.

The error code can be one of the following:

  • 40 - the MPN Module is disabled, either by configuration or by license restrictions.

  • 41 - the request failed because of some internal resource error (e.g. database connection, timeout etc.).

  • 43 - invalid or unknown application ID.

  • 45 - invalid or unknown MPN device ID.

  • 48 - MPN device suspended.

  • 66 - an unexpected exception was thrown by the Metadata Adapter while authorizing the connection.

  • 68 - the Server could not fulfill the request because of an internal error.

  • <= 0 - the Metadata Adapter has refused the subscription request; the code value is dependent on the specific Metadata Adapter implementation.

- (void)mpnDevice:(nonnull LSMPNDevice *)device didFailBadgeResetWithErrorCode:(NSInteger)code message:(nullable NSString *)message

Parameters

device

The LSMPNDevice instance involved.

code

The error code sent by the Server.

message

The description of the error sent by the Server; it can be nil.

Declared In

LSMPNDeviceDelegate.h