Browse Source

SSE

master
Nadege 5 years ago
parent
commit
d1ac7586f7
1 changed files with 16 additions and 0 deletions
  1. 16
    0
      posts/routing.py

+ 16
- 0
posts/routing.py View File

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

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

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

Loading…
Cancel
Save