Notification Server¶
A Drupal module that provides real-time notification capabilities by integrating with an external notification server through HTTP and WebSocket protocols.
Developer Module
This is a developer module that provides APIs and services for integrating real-time notifications into your Drupal application. It will not do anything on its own and requires custom code or other modules to utilize its functionality.
Overview¶
The Notification Server module enables real-time notifications in Drupal applications by connecting to an external notification server. This module serves as a client interface to the Notification Server project and provides:
Self-Hosted Alternative
The Notification Server is a self-hosted solution that provides an alternative to SaaS-based real-time messaging services like Pusher, Firebase, or Ably. By running your own notification server, you maintain full control over your data, avoid vendor lock-in, and can customize the solution to meet your specific needs.
- HTTP API Client - For publishing notifications and managing channels
- WebSocket Integration - For real-time bidirectional communication with browser clients
- Channel Management - For creating channels and managing access control
- Client Management - For handling WebSocket client connections
Use Cases¶
This module is particularly useful for:
- Real-time updates in web applications
- Push notifications to specific channels
- Live data streaming
- Chat applications
- Real-time dashboards
- Content moderation workflows
- User activity notifications
Quick Start¶
Basic Usage¶
<?php
// Get the notification client service
$notification_client = \Drupal::service('notification_server.client');
// Send a simple notification
$notification_client->publishNotification('channel_name', 'Hello, World!');
// Send a structured notification
$notification_client->publishNotification('user_notifications', [
'type' => 'info',
'message' => 'New content available',
'data' => [
'contentId' => 123,
'title' => 'Updated Article',
],
]);
WebSocket Integration¶
-
Generate a client ID (server-side):
-
Connect to WebSocket server (client-side):
-
Subscribe to a channel:
-
Listen for messages:
Getting Started¶
- Review the Requirements to ensure your system is compatible
- Check Dependencies to set up the external notification server
- Follow the installation instructions in Quick Reference
- Explore the Features to understand what's available
- Use the API Reference for detailed method documentation
Demo Module¶
The optional notification_server_demo module provides demo interfaces for testing:
- HTTP Demo:
/admin/config/system/notification-server/http-demo - WebSocket Demo:
/admin/config/system/notification-server/websocket-demo
See Notification Server Demo for more details.
Support¶
- Issue Queue: Project Issues (when available on Drupal.org)
- Notification Server Issues: GitHub Issues for server-related problems
Related Projects¶
- Notification Server - The external server this module connects to
- DDEV Notification Server Addon - Easy DDEV integration