from channels.routing import ProtocolTypeRouter, URLRouter
from django.urls import re_path
from channels.routing import URLRouter
from channels.http import AsgiHandler
from channels.auth import AuthMiddlewareStack
import django_eventstream

urlpatterns = [

    re_path(r'events/',
            AuthMiddlewareStack(URLRouter(django_eventstream.routing.urlpatterns)),
            {'channels': ['notice']}),
    re_path(r'', AsgiHandler),
]

application = ProtocolTypeRouter({
    'http' : URLRouter(urlpatterns)
})