Titivillus/titivillus/routing.py

22 lines
464 B
Python

#!/usr/bin/env python3
"""
Routing for Channels (websockets).
"""
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
import quest.routing
from .asgi_middleware import XRealIPMiddleware
CustomMiddlewareStack = lambda inner: XRealIPMiddleware(
AuthMiddlewareStack(inner)
)
application = ProtocolTypeRouter({
'websocket': CustomMiddlewareStack(
URLRouter(
quest.routing.websocket_urlpatterns
)
),
})