Please be aware that you are viewing our bleeding edge unstable documentation. Unless you wanted to view the bleeding edge (and possibly unstable) documentation, we recommend you use our stable docs.

Go to Ably's stable canonical documentation »

I know what I'm doing, let me see the bleeding edge docs »

You are viewing our bleeding edge unstable documentation. We recommend you use our stable documentation »
Fork me on GitHub

Push Notifications

Ably can deliver native push notifications to devices using, amongst others, Apple’s Push Notification service and Google’s Firebase Cloud Messaging service. Native push notifications, unlike Ably’s channel based pub/sub messaging, do not require the device to maintain a connection to Ably, as the underlying platform or OS is responsible for maintaining its own battery-efficient transport to receive push notifications. Therefore, native push notifications are commonly used to display visual notifications to users or launch a background process for an app in a battery-efficient manner.

Delivering push notifications


Push Notifications in Ably

As shown above, Ably provides two models for delivering push notifications to devices:

Direct publishing

Ably provides a REST API that allows native push notifications to be delivered directly to:

Find out more about direct push notification publishing

Channel-based broadcasting

The model for delivering push notifications to devices over channels is intentionally very similar to how messages are normally delivered using Ably’s pub/sub channel. For example, a normal message published on an Ably channel is broadcast immediately to all realtime subscribers of that channel. When broadcasting push notifications on channels, however, the process is the same with the exception that the subscribers (devices receiving push notifications) are registered in advance using our API and the message itself must contain an extra push notification payload that specifies the optional visual format and optional data payload of the native push notification.

Find out more about channel-based push notification broadcasting

Activating a device and receiving notifications

Every device that will receive push notifications must activate itself with the local operating system or framework, and hook into the push notification services that the underlying platform provides. This functionality is platform-specific and can also vary considerably across not just platforms, but also across the push services that operate on those platforms such as GCM and FCM, both of which are available on the Android platform.

The Ably client libraries aim to abstract away this complexity and platform-specific behaviour by providing a consistent API for device activation, maintenance of the device registration, and for subscription to Ably channels for receiving push notifications.

Find out more about device activations and subscriptions.

Managing devices and subscriptions

Whilst the realtime client libraries provide APIs for a device to activate itself (via client.push) and subscribe for push notifications (via channel.push), those APIs are intentionally limited to actions pertaining to the device it is run on.

A separate and distinct push admin API is additionally provided in our client libraries specifically designed for use by your servers to facilitate managing and delivering push notifications across all of your registered devices. This API, amongst other things, includes features to manage registered devices, channel subscriptions and deliver push notifications directly. Currently the push admin API is available in our JavaScript, Ruby, Java/Android and iOS libraries.

Find out more about the push admin API.

Platform support

Ably currently offers support for push notifications on the following platforms:

Apple Push Notifications
supported on all mobile devices running iOS and desktop devices running OS X
Firebase Cloud Messaging
supported on all Android and iOS devices, although we use FCM exclusively for Android message delivery
Experimental W3C Push API
experimental support for modern W3C compliant browsers (this does not include Apple’s Safari browser). Get in touch if you want to use this.

We no longer support Google Cloud Messaging; this is deprecated by Google, in favour of FCM, and the service will soon be terminated altogether.

Downloading a client library with push support

The following Ably client library SDKs provide support for activation and receiving of native push notifications:

All Ably client library SDKs, that adhere to the v1.1 specification support, support push publishing and push admin functionality.

See the list of client libraries available for download

Key features

Tutorials

If you wish to see step by step instructions to set up, send and receive push notifications on your mobile devices, you can checkout our tutorials for iOS and Android, with both direct device registration and registration via server examples.

Smart Notifications (coming soon)

Ably’s Smart Notifications offers a less intrusive and more effective way to notify your users with native iOS, Android and browser notifications. Instead of delivering “dumb” push notifications to your users when you wish to get their attention, Ably allows you to deliver messages based on a user’s connection state, their active device and their current context within your application. This means you can send less but more effective notifications to your users. Find out more.

How do Smart Notifications work?

Each Ably pub/sub channel can have one or more devices registered to it, and every device registered can be assigned a client identifier (i.e. they are an identified client in the Ably system).

When a message is published on a pub/sub channel, a smart notification payload and rules can optionally be included with the message. When the Ably service receives a message with a smart notification payload, it will do one of two things:

Find out why we believe smart notifications will be the next evolution of messaging.

Get in touch if you’d like to be notified when Smart Notifications go into beta


Back to top