diff --git a/backend/realtime/models.py b/backend/realtime/models.py deleted file mode 100644 index 71a83623..00000000 --- a/backend/realtime/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/backend/realtime/tests.py b/backend/realtime/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/backend/realtime/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/backend/realtime/views.py b/backend/realtime/views.py deleted file mode 100644 index 91ea44a2..00000000 --- a/backend/realtime/views.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/backend/static/js/notifications/notification-manager.js b/backend/static/js/notifications/notification-manager.js index b11bb043..68e389ce 100644 --- a/backend/static/js/notifications/notification-manager.js +++ b/backend/static/js/notifications/notification-manager.js @@ -95,7 +95,8 @@ class NotificationManager { connectWebSocket() { const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const wsUrl = `${protocol}//${window.location.host}/ws/notifications/`; + // Используем универсальный WebSocket endpoint (realtime architecture) + const wsUrl = `${protocol}//${window.location.host}/ws/`; console.log('[Notifications] Connecting to:', wsUrl); @@ -145,7 +146,13 @@ class NotificationManager { this.updateBadge(data.count); break; - case 'new_notification': + case 'notification': // UserConsumer использует "notification" + this.showNewNotification(data.notification); + // Инвалидируем кеш при получении нового уведомления + invalidateNotifications(); + break; + + case 'new_notification': // Backwards compatibility this.showNewNotification(data.notification); this.updateBadge(data.notification.unread_count); // Инвалидируем кеш при получении нового уведомления