Files
hereconnect/services/message-delivery-method-web-push
ti 1810c550ba
Deploy app frontend / app frontend (push) Failing after 48s
Deploy db-migrations / db-migrations (push) Failing after 35s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Failing after 53s
create qr-codes by tg bot
2024-12-12 01:48:15 +02:00
..
2024-12-12 01:48:15 +02:00
2024-12-03 14:33:55 +02:00
2024-12-12 01:48:15 +02:00
2024-12-12 01:48:15 +02:00
2024-12-03 19:38:02 +02:00
2024-12-12 01:48:15 +02:00

Web Push Notification Service

This service delivers web push notifications for chat messages and QR code events in HereConnect. It listens for changes in CouchDB and sends push notifications to users.

Features

  • Monitors CouchDB for new messages.
  • Sends push notifications to owners and guests.
  • Configurable notification settings.
  • Health server for monitoring.

Prerequisites

  • Node.js >= 14.x
  • CouchDB server
  • VAPID credentials

Installation

npm install

Running the Service

npm start

Usage

The service listens for changes in messages and sends notifications when a new message is created if the recipient has enabled push notifications.

Notifications are sent for:

  1. Messages from Guests: Sends to owners.
  2. Messages from Owners: Sends to guests if enabled.

Key Components

  • CouchDBChangesStream: Listens to CouchDB changes.
  • ServiceSeqTracker: Tracks sequence numbers to prevent missed messages.
  • Web Push Notifications: Uses web-push library.
  • Health Server: Monitors service status.

Notifications

New messages: Sends a push notification with title, body, and link to the chat.

Error Handling

Logs errors when sending notifications. Tracks sequence to avoid missed messages.

Graceful Shutdown

Handles SIGINT to stop CouchDB changes stream and clean up.

Health Monitoring

Includes a health server for checking service status.

References