Monday, October 29, 2018

How to subclass AsyncHttpConsumer for a GET request?

Hi there,

Newbie to Channels.

I am trying to write a Async consumer to handle a http GET request
How to write a subclass MyAsynHttpConsumer(AsyncHttpConsumer) for this purpose? Or I am looking at the wrong class?

Also if I understand correctly, I should manually add a new pair 'http': MyAsynHttpConsumer to ProtocolTypeRouter()

async_http_urlpatterns = [
    url(r'^async-http/$', consumers. MyAsynHttpConsumer   ),
]

ProtocolTypeRouter ( 
'http': AuthMiddlewareStack(
        URLRouter(
             my_channels_app.routing.async_http_urlpatterns
        )
    ),
)

Thanks
Drew



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMmsbUnBV5x8ZEQ4xDC9v2V7EB%3DvpwnFREhZYTWnc5Xzf93J2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment