A Production-Grade Websockets Setup with Nginx, uWSGI and Python

level09
4 min readSep 19, 2021

In this article I will provide a glimpse of how to setup a high performance and simple web sockets backend server to use with your Python (Flask) apps.

This is the same setup we use at Mixed CRM to power our real-time updates and notifications.

Mixed CRM is a simple automation/property booking and sales CRM that makes it easy for Real estate companies to sell properties in a collaborative and modern manner. you can play with a demo here.

Running a web sockets server might sound simple initially, but as you dig deeper, you realize there are many tricky aspects to it.

Our Setup Goals

When we were initially looking for setting up web sockets, we had a few requirements in mind:

  1. We wanted it to be python based, so it would be easier to integrate with our web framework, this will make it much easier to share things like application context and session etc ..
  2. We wanted an easy way to run it locally while doing development work, without having to switch a lot of configurations.
  3. We wanted a solid, and scalable setup for production use, that will handle a good number of concurrent users/connections without issues.
  4. It has to support…

--

--

level09

Technology Specialist, the author of Enferno Framework, Mixed CRM