Spaces:
Sleeping
Sleeping
Introduce WebSocket-based notification service with targeted delivery and subscription support.
858bf77 | title: NotificationChannel | |
| emoji: 🔔 | |
| colorFrom: indigo | |
| colorTo: blue | |
| sdk: docker | |
| pinned: true | |
| Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |
| # 🔔 NotificationChannel | |
| **Service de notifications en temps réel professionnel** | |
| *Notification push • WebSockets • Diffusion ciblée • Historique* | |
| ## ✨ Fonctionnalités | |
| - 🚀 **Connexions WebSocket** - Gestion optimisée des connexions persistantes | |
| - 🎯 **Notifications ciblées** - Envoi par utilisateur, rôle ou diffusion globale | |
| - 📊 **Historique intelligent** - Conservation des dernières notifications | |
| - 🔐 **Sécurité renforcée** - Gestion de session et validation | |
| - 📈 **Monitoring intégré** - Statistiques temps réel des connexions | |
| ## 🏗️ Architecture | |
| ```mermaid | |
| graph TD | |
| A[Client] -->|WebSocket| B(API Gateway) | |
| B --> C{NotificationChannel} | |
| C --> D[(Historique)] | |
| C --> E[Utilisateur] | |
| C --> F[Rôle] | |
| C --> G[Broadcast] | |
| ``` | |
| ## 🚀 Déploiement | |
| ```bash | |
| # Construction de l'image | |
| docker build -t notification-channel . | |
| # Lancement du service | |
| docker run -d -p 7860:7860 --name notif-service notification-channel | |
| ``` | |
| **Accès rapide :** | |
| - Interface : http://0.0.0.0:7860 | |
| - Documentation API : http://0.0.0.0:7860/api-docs | |
| ## ⚙️ Configuration | |
| | Variable | Défaut | Description | | |
| |--------------------|---------|--------------------------------------| | |
| | `APP_HOST` | 0.0.0.0 | Adresse d'écoute du service | | |
| | `APP_PORT` | 7860 | Port d'écoute du service | | |
| | `MAX_HISTORY_SIZE` | 1000 | Taille max de l'historique | | |
| | `NOTIF_TTL` | 3600 | Durée de vie des notifications (sec) | | |
| ## 🔄 Workflow CI/CD | |
| ```mermaid | |
| graph LR | |
| A[Code] --> B[Tests] | |
| B --> C[Build Docker] | |
| C --> D[Scan Sécurité] | |
| D --> E[Staging] | |
| E --> F[Validation] | |
| F --> G[Production] | |
| ``` | |
| ## 📋 API Endpoints | |
| ### WebSocket | |
| - `ws://localhost:8000/ws/{user_id}` - Connexion utilisateur | |
| - `ws://localhost:8000/ws/broadcast` - Diffusion globale | |
| ### REST API | |
| - `POST /notify/user/{user_id}` - Notification individuelle | |
| - `POST /notify/role/{role}` - Notification par rôle | |
| - `POST /notify/broadcast` - Diffusion générale | |
| - `GET /history/{user_id}` - Historique utilisateur | |
| ## 🛠️ Développement | |
| ```bash | |
| # Installation des dépendances | |
| pip install -r requirements.txt | |
| # Lancement en mode dev | |
| uvicorn main:app --reload --host 0.0.0.0 --port 7860 | |
| ``` | |