Skip to content

Investigate cross-device notification dismissal alternatives #9

@emilhauk

Description

@emilhauk

Context

We removed the cross-device push notification dismissal mechanism (clear pushes) in the commit that references this issue. When a user opened a room on one device, the server sent data-only "clear" Web Push notifications to all other subscriptions to dismiss stale notifications. This has been removed.

Why it was removed

  1. Chrome push budget penalty — Chrome penalizes silent pushes (pushes that don't result in user-visible notifications). Our suppressNotification() workaround (show a notification and immediately close it) is fragile and still counts against the budget.
  2. suppressNotification() fragility — The 100ms show-then-close timing is a race condition. If Chrome changes its internal behavior, this breaks silently.
  3. Safari differences — Safari doesn't have the same silent push restrictions, but the workaround is Chrome-specific and adds complexity for all platforms.

What still works

  • Same-device clearing via postMessage from the active tab to the Service Worker. This is free, instant, and reliable.

Alternative approaches to investigate

  • TTL-based expiry — Set short TTL on push notifications so they auto-expire. Doesn't solve cross-device clearing but reduces stale notification window.
  • Tag-based replacement — Use consistent tags so new notifications replace old ones on the same device. Already partially in place.
  • Background Sync API — Register a sync event when the user opens a room; the SW can then clear notifications without a push. Limited browser support.
  • Periodic Background Sync — Periodically check server for read state and clear notifications. Very limited browser support (Chrome only, requires installed PWA).
  • Accept the trade-off — Notifications on other devices persist until tapped or manually dismissed. This is the current behavior of most chat apps on web.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions