I have a large Django application, that is WSGI based, but it also has websockets (for notifications) implemented by using Django Channels.
This application also offers users to download some files.
Up until now, those files were only smaller reports (<2MB).
Plan is to enable download of some other stuff, that can be in GBs in size.
Implementing that in WSGI fashion is a futile effort, as it freezes the whole application for the user, making the UX bleak.
I want to use django channels http protocol for creating this download feature.
I don’t have a lot of experience using Django and its libraries, but the channels documentation, or to be hones in any other part of the internet,
I was unable to find how to make http and websocket protocols coexist, i.e how to create asgi.py that will support both asgi http urlpatterns, and websocket urlpatterns
Example in the official documentation,
http is set to get_asgi_application(),
and websocket has an actual urlrouter.
I see that AsyncHttpConsumer exists,
so I believe this should be possible,
but I’m unable to figure it out.
I won’t paste my lame attempts here that didn’t work, but basically just removing
get_asgi_application() and replacing it with
URLRouter didn’t work,
and I don’t have a better idea.
Again, what I’m surprised by is that I’m unable to find any example of this on the internet, as I would expect it to be a common use case, not necessarily download, but any other async stuff over channels.
Any code pointers / examples / suggestions on how to have urlpatterns for both http and websocket protocol in Django Channels would be highly appreciated