Pycon Israel 2021

WebSockets and Flask for the real world
2021-05-03, 14:00–14:25, General Track 1

Implementing a Flask realtime web application for production isn’t as easy as it seems.
Learn how to use Redis Pub/Sub, Ngnix, uWSGI, signaling, unix socket, mule process, socket.io and more to create a robust realtime app.


socket.io enables real-time, bidirectional, event-based communication between the browser and the server.
Ideally Pythonists running a Flask application would simply use the Flask-SocketIO library, yet Flask alone is not suitable for production and must be hosted by a real web server. Thus requiring additional development to enable the usage of socket.io.

Our Framework consists of a uWSGI server running Flask instances and other services behind a Nginx proxy. We will share a full working solution of a framework setup that supports Flask realtime web application in production.

The framework includes Redis Pub/Sub to publish events from any service, a mule service to listen to events, uWSGI signaling to notify all workers, socket.io on a Redis backend
to allow lazy-apps, a new Nginx mapping and another http listener in the uWSGI server.


Session language – English Target audience – Developers