Push Notifications: A New Feature Added to Ring Project
Push notifications are essential part of the effective end-user experience on mobile platforms. They tend to boost the app engagement and users find them useful and handy as they ease their communications. Although push notifications are widely considered an advantage for most apps, they are regarded most useful for messaging, email and other types of communication apps in general. For this reason, our team of developers have been working hard to make sure Ring is equipped with such critical feature in lockstep with Ring users’ expectations. Today, Ring’s push notification is available for its Android and iOS versions and the users can stay informed of their accounts’ developments while their phones have been idle.
What Is a Push Notification?
When a smartphone is idle, certain applications are still capable of receiving notifications. This is mostly the case when a new message or an email is received. This notification, coming from an external server, forces the device to wake up from its standby mode and therefore is called “push notifications”. Adding this feature to Ring enables its users to be duly informed of a new message, a new call or even a friend request even when their application is not open or their phone is sleeping.
Why Is It a Challenge to Add a Push Notification to Ring?
Platforms like iOS refuse to have an application running in the background while the device is idle. Android now has similar restrictions (with Doze), at least for apps published on the Play Store. However, because Ring is fully distributed, powered by OpenDHT, it requires a DHT node to continuously listen to the network to be able to be notified of new messages or calls. To work with push notifications, a mobile device should request a remote DHT node (also referred to as a DHT proxy), in order to be able to receive push notifications and perform operations on the distributed network. While the device is listening for push notifications through a proxy node, Ring on the user's phone is automatically woken up upon receiving a trigger such as a new call or message. It would then retrieve the piece of information from the network, decrypt it, and eventually notify the user.
How Do Push Notifications work in Context of Ring?
When a user starts using Ring, a DHT node is automatically started. This node will do the job of exchanging information with the other DHT nodes available in the Ring network. Since Ring runs on a distributed network, the Ring app can operate in a distributed manner without any central server, thereby the network acts in place of an external centralized server.
However, we know that from a technical standpoint, the push notification system must be centralized. This is mainly because a push notification must travel through the push provider which is a service owned and provided either by Google (usually FCM) in case of Android, or by Apple (APN) for iOS devices. Equally important, the push gateway is a second service that is responsible for creating the notifications and passing it to the FCM or APN. Using information necessary for authentication (a password or a certificate) with the push provider, the push gateway must also be centralized.
Today, Savoir-faire Linux hosts the push gateway for the Ring app on a server “GoRush”. The specifications of which can be found in GitHub.
The push gateway is however accessible from any node of the OpenDHT network. This gateway can also be hosted on any other server, however, in this case the user is required to re-sign the Android or iOS application with the appropriate certificates to use push notifications.
It is noteworthy to mention that since the respect for privacy is our core value and of utmost importance in Ring project, we made sure that no sensitive user data goes through push notifications. Since the push server and push gateway have access to some potentially sensitive metadata (receiver IP address and device ID, time of events), and because push notifications require a central service, push notifications will always be optional.
A Closer Look into How Push Notifications Operate
By the end of 2017, with the help of the Free software community, we managed to make sure that OpenDHT has the capability to connect the user’s application to the main OpenDHT network through a proxy node. This makes sure that the node representing the user on the hash table can in fact connect to the proxy node and make a request to listen to the distributed network while being in its original place on the distributed network. The proxy, consequently, sends back the data to the user’s node to be decrypted. The ability to perform operations on the distributed network using proxy node can drastically reduce the consumption of mobile data. The user's local node is no longer synchronized with the rest of the network, but is only connected to the proxy. The feedback or information exchange between the node and the proxy can be done either directly, with a simple HTTP/TCP connection, or through a push notification. If the user chooses to go through push notifications, the proxy will send notifications and authentication information to the push provider via the push gateway hosted by Savoir-faire Linux.
Push notifications through the DHT proxy now allow Ring users to receive calls and messages at any time, even when their device is sleeping, while reducing mobile data and battery usage.