Titivillus/titivillus/routing.py

22 lines
464 B
Python
Raw Normal View History

2018-08-14 20:12:52 -04:00
#!/usr/bin/env python3
"""
Routing for Channels (websockets).
"""
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
import quest.routing
2018-08-30 23:33:25 -04:00
from .asgi_middleware import XRealIPMiddleware
CustomMiddlewareStack = lambda inner: XRealIPMiddleware(
AuthMiddlewareStack(inner)
)
2018-08-14 20:12:52 -04:00
application = ProtocolTypeRouter({
2018-08-30 23:33:25 -04:00
'websocket': CustomMiddlewareStack(
2018-08-14 20:12:52 -04:00
URLRouter(
quest.routing.websocket_urlpatterns
)
),
})