@opuscapita/notification-client
v1.3.0
Published
Shared logic for websocket notification client for both BNAPP and IPA
Maintainers
Keywords
Readme
Notification-Client Library
Overview
The Notification-Client library is a React-based solution designed to deliver real-time notifications to users in a web application. It integrates with a WebSocket backend (live-notification) to provide instant updates and filters notifications dynamically based on the currently active service within the application.
Key Features
- Real-Time Updates: Utilizes WebSocket technology for immediate delivery of notifications.
- Backend Filtering: The WebSocket backend (live-notification) filters notifications based on user roles and business partners before broadcasting.
- Client-Side Service Filtering: The client filters notifications based on the currently displayed service (URL path).
- Integration: Serves as a wrapper around the main application.
Requirements
The library can be used without any props:
<LiveNotificationContainer>
{/* Your app content */}
</LiveNotificationContainer>Optional props:
useMargin: Boolean to add margin to the container (default: false)children: React nodes to be wrapped by the notification container
How It Works
- Backend Communication (live-notification): Connects to the WebSocket backend to receive live notifications.
- Backend Filtering: The server filters notifications by user roles and business partners before sending them to the client.
- Client-Side Filtering: The client filters notifications based on
TargetServicesmatching the current URL path. - Local Storage: Tracks read notifications to prevent displaying them again.
- Seamless Embedding: Acts as a container for the main application, wrapping its content and managing notifications without disrupting the user experience, showing notifications at the top of the screen.
