Websocket
JST DJANGO websocket module
O'rnatish
jst install {app_name} # default websocketconfig/awsgi.py
config/awsgi.pyimport os
from django.core.asgi import get_asgi_application
asgi_application = get_asgi_application()
from channels.routing import ProtocolTypeRouter, URLRouter # noqa
from config.env import env # noqa
### New Lines
from core.apps.websocket.urls import websocket_urlpatterns # noqa
from core.apps.websocket.middlewares import JWTAuthMiddlewareStack # noqa
### \New Lines
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
application = ProtocolTypeRouter(
{
"http": asgi_application,
"websocket": JWTAuthMiddlewareStack(URLRouter(websocket_urlpatterns)), # New Line
}
)
Structure
Last updated