Flask-SocketIO
Socket.IO integration for Flask applications.
Flask-SocketIO is a Python package that lets a Flask web application communicate with a browser in real time, sending messages back and forth without the browser needing to repeatedly ask the server for updates. Flask is a popular, lightweight framework for building websites and APIs in Python. Socket.IO is a protocol that keeps an open connection between a browser and a server so either side can send a message at any moment. This package wires the two together.
Without something like this, a web page has to refresh or poll the server every few seconds to check for new information. With Flask-SocketIO, the server can push a message to the browser the instant something happens, and the browser can reply. This makes it practical to build things like chat applications, live dashboards, or collaborative editing tools on top of a Flask backend.
Installing the package is a single pip command. Once installed, you wrap your existing Flask app with the SocketIO object, then define event handlers using a decorator. The short example in the README shows an app that listens for an event called my_event and immediately emits a response back to whoever sent it. Starting the server is one line of code.
The README is brief and mostly contains the installation instruction and a minimal code sample. For a fuller picture of what the library can do, such as broadcasting to multiple connected clients, handling rooms, or integrating with authentication, the official documentation is available on Read the Docs and a tutorial exists on the author's blog. Questions from the community are also archived on Stack Overflow under the flask-socketio tag.