Overview
The Notifications service handles:- Real-Time Updates: WebSocket connections for instant notifications
- SignalR Hubs: Authenticated and anonymous notification hubs
- Message Broadcasting: User, organization, and installation-wide notifications
- Connection Management: Active connection tracking and health monitoring
- Queue Processing: Azure Queue integration for notification delivery (cloud)
Architecture
SignalR Hubs
The service exposes two SignalR hubs:Authenticated Hub
Fromsrc/Notifications/NotificationsHub.cs:12:
NotificationsHub
/hub
Authentication: Required (Bearer token)
Groups:
- User groups (per client type)
- Organization groups
- Installation groups
Anonymous Hub
Fromsrc/Notifications/AnonymousNotificationsHub.cs:9:
AnonymousNotificationsHub
/anonymous-hub
Authentication: Anonymous with token-based groups
Use Case: Send file sharing notifications
Configuration
Application Settings
Fromsrc/Notifications/Startup.cs:23:
Service Configuration
Redis Backplane
Redis is required for scaling the Notifications service across multiple instances.
Redis Configuration
Redis Setup
Hub Configuration
Fromsrc/Notifications/Startup.cs:112:
Hub Endpoints
Notification Groups
The service uses SignalR groups for targeted message delivery:User Groups
Fromsrc/Notifications/NotificationsHub.cs:107:
User Group Format
UserClientType_{guid}_BrowserUserClientType_{guid}_MobileUserClientType_{guid}_Desktop
Organization Groups
Fromsrc/Notifications/NotificationsHub.cs:112:
Organization Group Format
Installation Groups
Fromsrc/Notifications/NotificationsHub.cs:100:
Installation Group Format
Message Types
Clients receive different types of notifications:Sync Required
Notifies clients to sync vault data
Cipher Update
Specific cipher was modified
Folder Update
Folder structure changed
User Updated
User settings or profile changed
Logout
Force client logout
Auth Request
Passwordless auth request
Client Connection
JavaScript Example
C# Example (Mobile/Desktop)
Controllers
The service includes controllers for triggering notifications:Send Controller
Fromsrc/Notifications/Controllers/SendController.cs:
Background Services
Fromsrc/Notifications/Startup.cs:68:
Heartbeat Service
Heartbeat
Queue Processor (Cloud Only)
Queue Processing
Connection Tracking
The service tracks active connections:Connection Counter
Middleware Pipeline
Fromsrc/Notifications/Startup.cs:81:
Request Pipeline
Deployment
Environment Variables
Docker
Scaling Considerations
When running multiple instances, Redis backplane is required for message distribution.
Performance Optimization
Message Pack Protocol
The service uses MessagePack for efficient binary serialization:MessagePack Configuration
- Smaller message size
- Faster serialization
- Reduced bandwidth
Buffer Configuration
Buffer Sizes
Monitoring
Health Checks
Monitor active connections:Connection Metrics
Track:- Total active connections
- Connections per hub
- Group membership counts
- Message throughput
Troubleshooting
Common Issues
Debug Logging
Related Services
- API Service - Triggers notifications
- Events Service - Event-driven notifications
- Identity Service - Authentication tokens