For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Migrate to push notifications from event source-based notifications

From IBM MobileFirstâ„¢ Platform Foundation V8.0.0, the event source-based model is not supported, and push notifications capability is enabled entirely by the push service model. For existing event source-based applications on earlier versions of MobileFirst to be moved to V8.0.0, they must be migrated to the new push service model.


Overview

During migration, keep in mind that it is not about using one API instead of another, but more about using one model/approach versus another.

For example, in the event source-based model, if you were to segment your mobile application users to send notifications to specific segments, you would model every segment as a distinct event source. In the push service model, you would achieve the same by defining tags that represents segments and have users subscribe to the respective tags. Tag-based notifications is a replacement to event source-based notifications.

Table 1 provides you with a comparison between the two models.

Table 1. Event source-based model versus push service model
User requirement Event source model Push service model
To enable your application with push notifications

  • Create an Event Source Adapter and within it create an EventSource.
  • Configure or setup your application with push credentials.

  • Configure or setup your application with push credentials.
To enable your mobile client application with push notifications

  • Create WLClient
  • Connect to the MobileFirst Server
  • Get an instance of push client
  • Subscribe to the Event source

  • Instantiate push client
  • Initialize push client
  • Register the mobile device
To enable your mobile client application for notifications based on specific tags Not supported. Subscribe to the tag (that uses tag name) that is of interest.
To receive and handle notifications in your mobile client applications Register a listener implementation. Register a listener implementation.
To send push notifications to mobile client applications

  • Implement adapter procedures that internally call the WL.Server APIs to send push notifications.
  • WL Server APIs provide means to send notifications:

    • By user
    • By device
    • Broadcasts (all devices)
  • Backend server applications can then invoke the adapter procedures to trigger push notification as part of their application logic.

  • Backend server applications can directly call the messages REST API. However, these applications must register as confidential client with the MobileFirst Server and obtain a valid OAuth access token that must be passed in the Authorization header of the REST API.
  • The REST API provides options to send notifications:

    • By user
    • By device
    • By platform
    • By tags
    • Broadcasts (all devices)
To trigger push notifications as regular time periods (polling intervals) Implement the function to send push notifications within the event-source adapter and this as part of the createEventSource function call. Not supported.
To register a hook with the name, URL, and the even types. Implement hooks on the path of a device subscribing or unsubscribing to push notifications. Not supported.

Parent topic: Migrating apps from earlier releases