04 / 08

Notifications and OneSignal

Your like never waits on a push provider

OneSignalTriggersSweeps

Overview

There are three layers. The in-app inbox shows new followers, likes, comments, reposts, mentions and release days for games you watch; tapping a release opens the game, a like, comment, repost or mention opens the post, and anything else opens the profile. Release reminders are scheduled on your phone for 09:00 on release day, for dates known to the day. And the backend has a push pipeline that delivers the same inbox rows through OneSignal. The app's OneSignal registration ships with the next store build; until then, the inbox and the local reminders carry everything.

How it works

  1. 1

    A database trigger writes a notification row in the same transaction as the action. That row feeds the inbox directly.

  2. 2

    A scheduled push sweep picks up rows not yet sent and delivers them through OneSignal's API. A row is marked as pushed only after OneSignal accepts it, so a failed send is retried on the next sweep, never dropped and never sent twice.

  3. 3

    Push targets your Prysm account through OneSignal's external id, not a single device.

  4. 4

    A separate release sweep finds games whose announced release day has arrived and writes a notification for everyone watching. It only fires for day-precise dates, looks back a couple of days to catch missed runs, and a unique constraint allows one alert per watcher per game.

  5. 5

    Unfollowing and re-following does not ring the bell twice. Mentions notify up to the first ten people in a post.

Architecture flow

  1. 1

    Action

    A like, a follow, a comment.

  2. 2

    Trigger

    Same transaction: the notification row is written with the action.

  3. 3

    Inbox

    The app reads the row straight away.

  4. 4

    Push sweep

    On a schedule, marks a row pushed only after OneSignal accepts it.

  5. 5

    OneSignal

    Delivers to every device signed in to your account.

Key decisions

A sweep, not send-on-insert

Your like must never fail or slow down because a push provider is having a bad minute. The sweep costs a short delay, which is fine for social notifications.

Every push is news

Each notification is tied to something that happened to you: a friend acted, or a game you watch came out. There are no “we miss you” nudges. A reminder before a free trial ends is planned, through the same sweep.

Local reminders for release day

A release date the phone already knows can be scheduled on the phone, with no server round trip and no push token. Permission is asked when you turn a reminder on, when the reason is obvious.

Quick reference

Datanotifications, game watches
Functionspush-sweep, game-release-sweep
Built on
OneSignalexpo-notificationspg_cron
Updated