Django — Chat

Dishank Poddar
Yodaplus
Published in
2 min readAug 24, 2021

What is it, and why is it needed?

The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user’s browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.

Channels is a project that takes Django and extends its abilities beyond HTTP — to handle WebSockets, chat protocols, IoT protocols, and more. It’s built on a Python specification called ASGI.

Websocket allows us to build completely dynamic web app elements such as chat and notifications. Django Channels is an official Django library that allows us to integrate websockets using Python’s ASGI specification. It also has a solid tutorial to get your foot into how to use websockets with Django. However the tutorial stops at that and to build a fully functional chat app we need many more elements which we will be exploring in this series of articles. These include everything from saving the messages sent to adding frontend utilities that make the chat more user friendly to adding functional utilities like notifications and presence.

Prerequisites

This is compulsory. Follow the installation documentation as well as the Tutorial. This article is NOT about how to use web sockets in Django since it is well explained in the official documentation

  • The system to create a ‘connection’ between two users.

Related Articles

--

--