Files
Barış Keserandgoogle-labs-jules[bot] 529a578901 fix: missing websocket route for notifications (#362)
In `aniscrap_core/asgi.py`, the `URLRouter` only included `routing.websocket_urlpatterns` and `ws/chat/`. It was missing the `ws/notifications/` route for the `NotificationConsumer`. This PR fixes this issue by adding the route in `aniscrap_core/asgi.py`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-07-26 20:12:07 +00:00

36 lines
1.2 KiB
Python

"""
ASGI config for AniScrap project.
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aniscrap_core.settings")
# Initialize Django ASGI application early to ensure the AppRegistry
# is populated before importing code that may import ORM models.
django_asgi_app = get_asgi_application()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.urls import path
from core.consumers import ChatConsumer
from users.consumers import NotificationConsumer
from apps.watchparty.consumers import WatchPartyConsumer
from apps.watchparty import routing
application = ProtocolTypeRouter({
"http": django_asgi_app,
"websocket": AuthMiddlewareStack(
URLRouter(
routing.websocket_urlpatterns + [
path("ws/chat/<str:room_name>/", ChatConsumer.as_asgi()), # Keeping legacy chat for now if needed, or remove?
path("ws/notifications/", NotificationConsumer.as_asgi()),
# Better to keep existing routes to avoid breaking other parts if any.
# However, the user asked for apps/watchparty as "The" module.
]
)
),
})