from django.urls import path from channels.routing import ProtocolTypeRouter, URLRouter from taxi.middleware import TokenAuthMiddlewareStack from trips.consumers import TaxiConsumer # http uses implicit settings, websocket needs to be explicit application = ProtocolTypeRouter({ 'websocket': TokenAuthMiddlewareStack(URLRouter([ path('taxi/', TaxiConsumer), ])), })
from django.urls import path # new from channels.routing import ProtocolTypeRouter, URLRouter # changed from taxi.middleware import TokenAuthMiddlewareStack from trips.consumers import TaxiConsumer application = ProtocolTypeRouter({ # we wrap URLRouter in our custom TokenAuthMiddlewareStack, so # all incoming connection requests will go through authentication method 'websocket': TokenAuthMiddlewareStack( URLRouter([ path('taxi/', TaxiConsumer), ]), ), })
from django.urls import path from channels.routing import ProtocolTypeRouter, URLRouter from taxi.middleware import TokenAuthMiddlewareStack from trips.consumers import TaxiConsumer application = ProtocolTypeRouter({ "websocket": TokenAuthMiddlewareStack(URLRouter([ path("taxi/", TaxiConsumer), ]), ) })
from django.core.asgi import get_asgi_application from django.urls import path from channels.routing import ProtocolTypeRouter, URLRouter from taxi.middleware import TokenAuthMiddlewareStack from trips.consumers import TaxiConsumer application = ProtocolTypeRouter({ 'http': get_asgi_application(), 'websocket': TokenAuthMiddlewareStack( URLRouter([ path('taxi/', TaxiConsumer.as_asgi()) ]) ), })
from django.core.asgi import get_asgi_application from django.urls import path from channels.routing import ProtocolTypeRouter, URLRouter from taxi.middleware import TokenAuthMiddlewareStack from trips.consumers import TaxiConsumer application = ProtocolTypeRouter({ 'http': get_asgi_application(), 'websocket': TokenAuthMiddlewareStack( URLRouter([ path('taxi/', TaxiConsumer.as_asgi()), ]), ), })