Example #1
0
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),
    ])),
})
Example #2
0
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),
        ]),
    ),
})
Example #3
0
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),
    ]), )
})
Example #4
0
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())
        ])
    ),
})
Example #5
0
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()),
        ]), ),
})