Implement default websocket.connect consumer.

This commit is contained in:
Andrew Godwin 2016-07-06 11:55:45 -07:00
parent 69168545d4
commit be127611e5
2 changed files with 11 additions and 1 deletions

View File

@ -53,6 +53,10 @@ class Router(object):
# called once, thankfully.
from .handler import ViewConsumer
self.add_route(Route("http.request", http_consumer or ViewConsumer()))
# We also add a no-op websocket.connect consumer to the bottom, as the
# spec requires that this is consumed, but Channels does not. Any user
# consumer will override this one.
self.add_route(Route("websocket.connect", null_consumer))
@classmethod
def resolve_routing(cls, routing):
@ -239,6 +243,12 @@ class Include(object):
return result
def null_consumer(*args, **kwargs):
"""
Standard no-op consumer.
"""
# Lowercase standard to match urls.py
route = Route
route_class = RouteClass

View File

@ -14,6 +14,6 @@ setup(
install_requires=[
'Django>=1.8',
'asgiref>=0.13',
'daphne>=0.13',
'daphne>=0.14',
]
)