Push notifications

From postmarketOS Wiki
🚧 This page is a work-in-progress. Some information contained within may be inaccurate or incomplete.

It's important to receive notifications from network during sleep mode*, but (unlike GMS calls or SMS messages) events from network is hard in that state. When phone suspend-to-ram the kernel freezes all processes and then set all unnecessary peripherials to their own power saving modes or suspend/shut down (if we don't need them to wake up), very hardware and peripherials's firmware spesific. Even the kernel goes RAM and gives control of the CPU to the firmware and then the CPU is basically shut down. Some peripherials can wake up the system and in mobile devices the modem belongs to these. The modem only go power-saving mode and still keep connection to the cellular network and if it receives a call or message, it wakes the system up. This (sleep-to-ram) is what Linux phones nowdays do, but in the future we will use stanby sleep-mode and receive notifications from the network as well. Then the kernel doesn't suspend the CPU or freeze all processes and the system need keep active connetion(s) to the services on network. The problem is we can't keep active connection to every service because the battery drains out. Android and iOS is solved this problem with Google Firebase Cloud Messaging and Apple Push Notification service, which means that every notification goes through these services. However, we also want notifications with only one or few active connections because battery-life.

* Remember, there is many various sleep modes like Suspend-to-Idle, Standby, Susbend-to-RAM, hibernation (actually not sleep mode) and compinations of these. This is important keep mind then talking about suspend. Typically phones use Standby or Suspend-to-RAM sleep modes..

The solution

On Linux, the solution for problem of push notifications is follows:

UnifiedPush

A few services are allowed to keep active connection when necessary and other notifications received with UnifiedPush protocol. UnifiedPush spesification standardize connection between application service -> push notification service (online) and notification push service (local via e.g. Dbus) -> application client.

Read more: UnifiedPush

Notification softwares

  • ntfy, WIP PR for Linux support

Links