Skip to main content
The Notifications service provides real-time push notifications to Bitwarden clients using SignalR over WebSockets, enabling instant vault synchronization across devices.

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

From src/Notifications/NotificationsHub.cs:12:
NotificationsHub
Endpoint: /hub Authentication: Required (Bearer token) Groups:
  • User groups (per client type)
  • Organization groups
  • Installation groups

Anonymous Hub

From src/Notifications/AnonymousNotificationsHub.cs:9:
AnonymousNotificationsHub
Endpoint: /anonymous-hub Authentication: Anonymous with token-based groups Use Case: Send file sharing notifications

Configuration

Application Settings

From src/Notifications/Startup.cs:23:
Service Configuration

Redis Backplane

Redis is required for scaling the Notifications service across multiple instances.
Redis Configuration
The Redis backplane ensures messages are delivered across all SignalR instances:
Redis Setup

Hub Configuration

From src/Notifications/Startup.cs:112:
Hub Endpoints

Notification Groups

The service uses SignalR groups for targeted message delivery:

User Groups

From src/Notifications/NotificationsHub.cs:107:
User Group Format
Examples:
  • UserClientType_{guid}_Browser
  • UserClientType_{guid}_Mobile
  • UserClientType_{guid}_Desktop

Organization Groups

From src/Notifications/NotificationsHub.cs:112:
Organization Group Format

Installation Groups

From src/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

From src/Notifications/Controllers/SendController.cs:
Authorization: Internal services only (API, Events)

Background Services

From src/Notifications/Startup.cs:68:

Heartbeat Service

Heartbeat
Monitors connection health and tracks active connections.

Queue Processor (Cloud Only)

Queue Processing
Processes notification messages from Azure Queue Storage.

Connection Tracking

The service tracks active connections:
Connection Counter
Used for monitoring and health checks.

Middleware Pipeline

From src/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
Benefits:
  • Smaller message size
  • Faster serialization
  • Reduced bandwidth

Buffer Configuration

Buffer Sizes
Optimized for typical notification message sizes.

Monitoring

Health Checks

Monitor active connections:

Connection Metrics

Track:
  • Total active connections
  • Connections per hub
  • Group membership counts
  • Message throughput

Troubleshooting

Clients must maintain active WebSocket connections. Check firewall and proxy settings.

Common Issues

Debug Logging