The notification system is a mechanism for sending and managing real-time notifications to users through a web interface. It operates on a publisher-subscriber principle, where various services can send notifications, and clients (users’ browsers) receive them in real time.
A base class for all notification types that provides:
A central coordinator that:
When a user opens the web interface, their browser establishes a connection with the notification server. The system remembers this connection and associates it with the specific user.
Any service can send a notification by specifying:
The system automatically:
Clients receive notifications in real time through the established connection. If the user is offline, notifications are saved and will be shown upon next connection.
Users can:
The system supports various notification types through separate services. Each type can have:
The system provides seamless user interaction by delivering important information in real time while maintaining history for future reference.
The notification system is initialized when the application starts through the bindNotifications() function, which:
GeneralNotificationService - general notificationsSystemNotificationService - system events and notificationsThe system is tightly integrated with the main Adminizer framework:
Adminizer provides convenient methods for sending notifications:
await adminizer.sendNotification({
notificationClass: 'general', // Notification type
title: 'New Message', // Title
message: 'You have a new message', // Message text
userId: 123, // User ID (optional)
metadata: { important: true } // Additional data
});
// General system event
await adminizer.logSystemEvent(
'System Update',
'The system has been successfully updated',
{ version: '2.0.0' }
);
// CRUD operation events
await adminizer.logSystemCreatedEvent('New User', 'User John Doe created');
await adminizer.logSystemUpdatedEvent('Profile Update', 'User profile updated');
await adminizer.logSystemDeletedEvent('Record Deletion', 'Record deleted from database');
The system automatically registers access rights for each notification type through AccessRightsHelper. Users can only receive notifications for which they have permissions.