""" ASGI config for chat project. It exposes the ASGI callable as a module-level variable named ``application``. """ import os from django.core.asgi import get_asgi_application from apps.chat.websocket import websocket_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') django_asgi_application = get_asgi_application() async def application(scope, receive, send): if scope["type"] == "http": await django_asgi_application(scope, receive, send) return if scope["type"] == "websocket": await websocket_application(scope, receive, send) return raise ValueError(f"Unsupported ASGI scope type: {scope['type']}")