Reputation: 429
I am little bit confused about the main roles of django-channels and uvicorn server. I have read a lot of blogs but did not get much clarification.
If we can implement an ASGI server for websockets using channels, then why do we need asgi server seperately like daphene or uvicorn?
Upvotes: 2
Views: 2602
Reputation: 577
Daphne is a ASGI server while Django Channels is an ASGI Framework for Django. Links have been taken from www.uvicorn.org.
Also reference from another blog is mentioned below:
Channels was created to support asynchronous protocols like Websockets and long polling HTTP. Django applications still run synchronously. Channels is an official Django project but not part of core Django.
Django Async project will support writing Django applications with asynchronous code in addition to synchronous code. Async is a part of Django core.
Both were led by Andrew Goodwin.
These are independent projects in most cases. You can have a project that uses either or both. For example if you need to support a chat application over web sockets, then you can use Channels without using Django’s ASGI interface. On the other hand if you want to make an async function in a Django view, then you will have to wait for Django’s Async support for views.
Upvotes: 2