Blazing fast notifications

To deliver notifications faster, companies either have to spend a fortune or rely on other push providers who claim to send notifications at the speed of sound(not exactly, but it does sound FAST enough).

Image Source: https://www.flickr.com/photos/28989463@N04/

How have these push providers been achieving it?

A simple answer would be parallel processing or switch to a programming languages which are meant for embarrassingly parallel systems. That’s not all, you would additionally need to avoid duplicates to avoid sending multiple push notifications. While some use algorithms like bloom filters others want to keep it a secret. Some of those techniques have been documented at the end of the blog.

Do you really need to do all that? No. Not always

This would depend on your use case. The following cases are where you can avoid doing all those complicated stuff.

CASE 1: All user notifications

If you want to send a notification to all your users, the answer is NO. There is a better and faster way. You can send a notification to all your users with a single API hit. I am not talking about any specific provider, but a service provided by Google called Gcm PubSub.

CASE 2: Send to specific set of users

If you want to send a notification to all users who have selected to be notified for a specific topic; for example a news category “Sports”, then also you can achieve this using a single API call. using the same google service

How

This can be achieved by using Topic Messaging introduced by Google in its play services gcm library in May 2015.

While the adoption rate for this has been pretty low (I have not seen anyone implement it), it is extremely useful.

So if it is that good, why is the adoption rate that low? I simple reason being lazy developers, who don’t read the documentation, while the other being, app developers these days do not even bother about this. They simply opt for a push provider like OneSignal, PushBots, Mixpanel, Localytics, MoEngage, Carnival etc.

Why should I even bother about this?

To be honest it’s a greener and cleaner approach. Yes, it’s greener. Think of it this way, you use servers hosted on some cloud service which uses electricity, cooling systems and a bunch of other resources. All this emits CO2. Not many developers think their coding affects each and every human being in this way.

I could not find a CO2 calculator nor do I have the time and resources to spend on researching exactly how much CO2 emissions happen for push notifications alone; I would like to lure you with another incentive for using Topic-based messaging.

While you can’t figure out the costs of CO2, you can count CPU cycles/usage and check their cost. Efficient code — Cheaper to run code.

Think of it this way, you do not need to segment your users when sending notifications for a specific topic. Simply send it based on topics and let google manage it. This way you manage to de-clutter your code and focus on other important aspects of your product.

If you are a content app and use push notifications then read the following post.