Notifications
clc-app-notifications tells CLC app users when they receive vouchers, messages and Safe approval requests. It stores each notification in PostgreSQL, then delivers it in the app through Centrifugo and as Web Push. River runs the delivery jobs in the same database.
Roles
One binary runs any mix of three roles, set in service.roles.
| Role | Does |
|---|---|
bridge | Reads the TRACKER stream from ETH Tracker and the MESSAGING stream from clc-core. Writes notifications and queues their jobs. |
worker | Runs River jobs: in-app delivery, Web Push, and cleanup. |
api | Registers devices, serves the inbox, and issues Centrifugo tokens to the app. |
What triggers a notification
| Event | Notification kind |
|---|---|
TRACKER.TOKEN_TRANSFER | voucher.received, for the recipient |
message.created in a direct conversation | message.received |
message.created in a helpdesk conversation | helpdesk.reply |
conversation.requested | message.request |
conversation.accepted | message.accepted |
pool.voucher_admitted | pool.voucher_admitted |
safe.* | Same kind |
Only users with APPROVED status in clc-core are notified. Reverted, zero-value and self transfers are skipped. A transfer that pays out a swap the user started is skipped too. The bridge records TRACKER.POOL_SWAP events to recognize these payouts.
Delivery
- The bridge stores the notification and queues an in-app job in one transaction.
- If the user has the app open, the worker publishes the notification to their Centrifugo channel and waits
display_waitbefore Web Push. If not, it moves on to Web Push at once. - Unless the app has shown the notification, the worker sends one Web Push per registered device that supports its kind.
- A push still undelivered after
alert_lifetimeexpires.
These pages follow clc-app-notifications at 00d228a.