Chapter 3: Adding WebSockets to Django
Channels is a Django extension that allows us to use protocols other than HTTP. The Django team, knowing the existing limitations of including other protocols, had to create a new server called Daphne that is natively compatible with the Asynchronous Server Gateway Interface (ASGI), an update of the Web Server Gateway Interface (WSGI). Without Channels, it would be impossible to have the WebSockets protocol.
You may wonder why the migration from WSGI to ASGI is so important. First, we need to understand what communication interfaces are. When we want to serve a Python site, be it Django or any other framework, we need to run software capable of keeping an instance active and mediating with any web server that makes requests. There are many interfaces for a web server to understand Python, but the most recommended is the WSGI specification, a Python standard for communication between a web server (Apache, Nginx, Caddy, etc.) and any Python web...