rmaps-online/backlog/tasks/task-3 - Add-push-notificat...

1.6 KiB

id title status assignee created_date updated_date labels dependencies priority
task-3 Add push notifications Done
2025-12-15 19:37 2026-01-02 14:27
medium

Description

Implement web push notifications for friend arrivals, proximity alerts, and group activity. Include battery-friendly polling options.

Implementation Notes

Implementation

Implemented comprehensive push notification system:

  1. Web Push with VAPID (sync-server/server.js)

    • VAPID key authentication for secure push
    • Push subscriptions stored per room
    • Silent push for location requests
    • Notification push for friend joins/meeting points
  2. Service Worker (public/sw.js)

    • Handles push events
    • Silent push triggers location update via postMessage
    • Notification push shows native notifications
    • Click handling opens room URL
  3. Push Hooks (src/hooks/usePushNotifications.ts)

    • Subscribe/unsubscribe to push notifications
    • Auto-subscribes when joining room
    • Handles VAPID public key fetching
  4. Location Request System

    • "Ping all" button with bell icon in friends list header
    • Individual ping button per participant
    • Deduplicates by name (only pings one session per user)
    • WebSocket for online clients, push for offline
  5. Background Location Sync

    • Automatic periodic location requests (60s interval)
    • Service worker messages for location sync
    • Background Sync API integration