Skip to content

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.

RoleDoes
bridgeReads the TRACKER stream from ETH Tracker and the MESSAGING stream from clc-core. Writes notifications and queues their jobs.
workerRuns River jobs: in-app delivery, Web Push, and cleanup.
apiRegisters devices, serves the inbox, and issues Centrifugo tokens to the app.

What triggers a notification ​

EventNotification kind
TRACKER.TOKEN_TRANSFERvoucher.received, for the recipient
message.created in a direct conversationmessage.received
message.created in a helpdesk conversationhelpdesk.reply
conversation.requestedmessage.request
conversation.acceptedmessage.accepted
pool.voucher_admittedpool.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 ​

  1. The bridge stores the notification and queues an in-app job in one transaction.
  2. If the user has the app open, the worker publishes the notification to their Centrifugo channel and waits display_wait before Web Push. If not, it moves on to Web Push at once.
  3. Unless the app has shown the notification, the worker sends one Web Push per registered device that supports its kind.
  4. A push still undelivered after alert_lifetime expires.

These pages follow clc-app-notifications at 00d228a.