In February Ably Push Notifications graduated from beta to general availability, bringing native mobile push notifications to the Ably platform through a simple, unified API.
In a few lines of code developers using Ably can register a device, subscribe to push notifications, and publish a push notification — making it much easier and simpler to send iOS and Android push notifications.
You can send notifications in two ways: over existing Ably channels to all subscribed devices or deliver direct to individual devices using the Ably REST Publishing API. Ably does all the heavy lifting in the background to deliver messages reliably and instantly via Apple Push Notification Service (APNs) for iOS and Firebase Cloud Messaging (FCM/GCM) for Android. If you'd like us to support Web Push, please get in touch.
What can you do with Ably Push Notifications?
Ably Push Notifications offer a host of new opportunities to engage with and inform mobile users in a way that’s more relevant, useful, and effective. Some good examples of how customers are already using Ably Push Notifications include:
- e-Commerce transaction notifications that keep buyers updated on the status of their orders from payment to delivery notifications
- Alerts based on specific triggers that monitor service health or usage
- Mobile gaming push notifications to keep players engaged and coming back for more
- Location-based push notifications to deliver timely or more contextual information
- Launching background processes in a battery-efficient way
To learn how to implement push notifications in your Ably app head over to the documentation or Android and iOS tutorials. If you’re thinking about implementing native push notifications we’d be happy to help — just reach out at any time.
This is a quick overview of how Ably Push Notifications operate. For more depth we recommend reading the documentation.
How are notifications delivered?
Ably delivers push notifications in two ways: direct publishing and over channels.
Publishing over a pub/sub channel means including a push payload in the extras object of the message that specifies this is a notification and not a standard message. Notifications are delivered to every device subscribed to the channel.
Direct publishing can deliver native notifications to individual devices in the following ways:
- Devices identified by their unique device ID
- Devices identified by their assigned clientId
- Devices identified by the recipient details of the native push transport such as their unique `registrationToken` in the case of FCM, `deviceToken` in the case of APNs, or `targetUrl` and `encryptionKey` in the case of a Web device (note: this is experimental).
Unlike messages sent with pub/sub, native push notifications don’t require a consistent connection for delivery. Instead the underlying operating system has its own battery-efficient transport for push notifications. Hence ‘native’ push notifications. In some scenarios it will be better to send native push notifications rather than over channels. This could be in areas with poor mobile connectivity, when battery life is an issue, or the notification doesn’t need to be sent right now.
Who can subscribe and who can publish?
Every one of the Ably client library SDKs can publish push notifications — except .NET and GO, which we hope to update soon. If you’d like to see this supported sooner please let us know.
Subscribing to native push notifications is supported on Android and iOS devices. We also have experimental support for Web Push for browser notifications.
How can devices receive native push notifications?
In order to receive native push notifications devices must be registered with the APNs (for iOS) and FCM (for Android).
There are two ways to register with APNs and FCM. The first is to have the device directly register itself via APNs or FCM. The second is to register a device by sending credentials to APNs or FCM on the device’s behalf.
The Ably Push Admin API allows you manage device registration without leaving your Ably app. For example, you can register and deregister devices using the POST method.
Send your first notification with Ably
It’s quick and easy to get started with native push notifications. For more information read the docs, view the tutorials, or get in touch and we’ll be happy to help. You can also read about the challenges of implementing a client-side WebSocket solution for iOS devices or see just what else the Ably Data Stream Network can do.