Files
GIA/app/asgi.py

30 lines
834 B
Python

"""
ASGI config for app project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
django_asgi_app = get_asgi_application()
async def application(scope, receive, send):
if scope.get("type") == "websocket":
path = scope.get("path", "")
if path == "/ws/compose/thread/":
from core.realtime.compose_ws import compose_ws_application
await compose_ws_application(scope, receive, send)
return
await send({"type": "websocket.close", "code": 4404})
return
await django_asgi_app(scope, receive, send)