From e9ba053f88ddc13e7cd7aed458e70ee475c8523e Mon Sep 17 00:00:00 2001 From: Vasilii Mikhailovskii Date: Tue, 3 Dec 2024 19:37:24 +0200 Subject: [PATCH] add readme --- .../README.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 services/message-delivery-method-web-push/README.md diff --git a/services/message-delivery-method-web-push/README.md b/services/message-delivery-method-web-push/README.md new file mode 100644 index 0000000..86a56be --- /dev/null +++ b/services/message-delivery-method-web-push/README.md @@ -0,0 +1,57 @@ +# 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 +```bash +npm install +``` + +## Running the Service +```bash +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. + + + + + +https://web-push-book.gauntface.com/demos/notification-examples/ +