I Want My Push Notifications!

Datetime:2016-08-22 22:33:37          Topic:          Share

When gathering requirements, I am often asked to architect applications that have a mobile component that revolve around push notifications. For many clients, push notifications are a "must have"—they absolutely cannot live without them. They see so many other mobile applications that seemingly also revolve around push notifications.

While push notifications are extremely handy and can add some serious value to your mobile application, there is an aspect to them that most people either don't know or overlook:

Push notification delivery is  not  guaranteed! It is made on a "best efforts" basis.

A quick look at iOS/APNS and Google/GCM documentation shows this to be true. The APNS documentation puts it best by saying that push notifications are "not intended to deliver data to your app, only to  notify the user that there is new data available."

Mission Critical

So what do you do when your client has mission-critical requirements that require the use of push notifications?

First off, you can reassure your client that push notifications most certainly can be integrated with their solution; however, it needs to be supplemented by other systems if a guarantee is needed.

Traditionally, if a client (mobile or otherwise) has needed to receive new data from a server, one of two ways has been utilized:

  1. Polling
  2. Event-based notification (i.e. with pre-registration)

The first option is one I am certain most of us are very familiar with; however, it can be a battery killer in the case of a mobile device and can also chew through data plans like a beaver through a log. That said, it is often the easiest to implement, so if cost of development is a big concern, don't dismiss this option out of hand.

The second option is clearly closer to the push notification option. How else can this be achieved?

Server Push

In the past several years, technologies such as COMET/HTTP Long Polling and HTTP Push (e.g. WebSockets ) have made such client/server data exchanges more accessible. More libraries are coming out to make things easier on the server side.

Perhaps my favorite such library (and likely most popular) is socket.io for Node.js. It makes event notifications very easy to achieve. And it goes beyond just simple "push notifications". For example, socket.io is the cornerstone to several online messaging/chat applications.

But while socket.io may seem like somewhat of a panacea, some care must be taken to ensure your application remains scalable. This can add development cost that your prospective client may or may not want to bear, so be sure to take this into account.

Conclusion

Messaging and push notifications are a mainstay of mobile application development. It's such a mainstay that many people think that mission critical functionality can be built around this technology. With a little patience, these clients can be educated and informed of the options that are available in order to properly ensure and better guarantee the delivery of their messages and new data.