Not sure if this is the best way. I just found 
inside AsyncHttpConsumer.handle() I can access self.scope['method'] to 
determine if it is a GET or POST or others.

Thanks
Drew






On Monday, October 29, 2018 at 3:50:43 PM UTC-6, Zhiyu/Drew Li wrote:
>
> 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+unsubscr...@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/8c46871d-6e24-47e1-8813-5721014aedca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to