Python Chat Tutorial with Django and React

Nick Parsons
4 min readMay 15, 2019

Unlike other tutorials, I’m not using Python/Django for WebSocket connections. While doing so may seem cool from a tech perspective, it’s pretty sluggish and expensive — especially if you have a halfway decent number of users. Languages such as C++, Go and Elixir are much better at handling the core of chat.

In this tutorial, we will use Stream, an API for chat that takes care of WebSocket connections and other heavy lifting using Go, Raft and RocksDB.

The GitHub repo for the code below can be found at https://github.com/GetStream/python-chat-example.

Before we start thinking about the Python chat side of things let’s spin up a simple React frontend, so we have something nice and visual to look at:

Replace the code in src/App.js with:

--

--