chat qo'shildi
This commit is contained in:
@@ -1,12 +1,27 @@
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
asgi_application = get_asgi_application()
|
||||
from config.env import env # noqa
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
|
||||
|
||||
|
||||
application = asgi_application
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||
|
||||
asgi_application = get_asgi_application()
|
||||
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter # noqa
|
||||
from django.urls import re_path # noqa
|
||||
|
||||
from core.apps.chat.consumers import ChatConsumer # noqa
|
||||
from core.apps.chat.middlewares.auth import JWTAuthMiddlewareStack # noqa
|
||||
|
||||
websocket_urlpatterns = [
|
||||
re_path(
|
||||
r"^ws/chat/room/(?P<room_id>\d+)/$",
|
||||
ChatConsumer.as_asgi(),
|
||||
),
|
||||
]
|
||||
|
||||
application = ProtocolTypeRouter({
|
||||
"http": asgi_application,
|
||||
"websocket": JWTAuthMiddlewareStack(
|
||||
URLRouter(websocket_urlpatterns)
|
||||
),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user