Push notifications in Erlang

Until I joined a certain project a few months ago, I wasn’t even aware of push notifications. Since that day I’ve heard phrase “push notifications” so many times, my memory instantly recalls one person who spoke with me about it most and I’m not sure if I feel comfortable seeing the same face in my mind every time I work on this subject but whatever… There are worse things like not being able to rid “Gangnam Style” out of one’s head or experiencing strange pleasure from listening to Nyan Cat for few hours straight.

From what I know, all major mobile OS providers have push notification services. From my point of view, the most significant would be:

  • iOS – Apple Push Notification System
  • Android – Cloud to Device Messaging
  • Blackberry
  • Windows Phone

Without a doubt, Erlang is tied to telecommunications since its birth. It is still true that its being used more and more frequently not only in low-level hardware, but also in e.g. chat servers for mobile applications.

Push notifications are nice invention. They compensate to certain degree two things:

  1. Unreliable mobile network connection (TCP won’t help!)
  2. Application threads frozen when app is in the background

I won’t discuss possible uses for Erlang servers with push notifications, I was rather curious are “pushes” well-supported by some libraries. I was really disappointed when I found out that apparently only a library for APNS exists. Perhaps there are some projects on GitHub but maybe my search skills are not as good as I thought.

Actually, I had an occasion to use this one library. It’s called ex_apns (click!) and is developed by creators of Cowboy server. I must admit I’m pretty happy with its API. Push messages binary formats are not very complicated but sometimes project schedule doesn’t allow experimenting with writing own solution. And of course – reinventing the wheel is good for learning or major refactoring, not for delivering new system as quickly as possible. 🙂

Above statement answers a potential question “Why need libraries, since sending pushes is usually quite simple?”. Yes, it’s simple. PayPal API is also well documented and seems to be not that complicated. This doesn’t change the fact it took me a few long hours to figure out its oddities. These are hours which can be saved for developing main logic, testing, deployment – just making the customer happy.

OK, so we have library for APNS. We still need some for C2DM, Blackberry and Windows Phone. We don’t want to be worse than e.g. PHP, right?

This entry was posted in Erlang and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s