skillfed

flask-sock

WebSocket support for Flask

flask-sock v0.7.0 2.1M downloads/30d#3,294 on PyPI317
Permissive license Active released

What it is and what it does

flask-sock is a Flask extension that adds WebSocket support to your application. Unlike some alternatives, it does not require a greenlet-based application server to function—it works out of the box with Flask's development server and can be deployed to production using standard WSGI servers like Gunicorn alongside Eventlet or Gevent for async handling. The extension integrates cleanly into Flask's routing model, letting you decorate handler functions to receive and send WebSocket messages.

The package depends on flask and simple-websocket for its core functionality. It's designed for developers who want bidirectional communication in Flask applications without the overhead of setting up a specialized server environment during development. For production, you pair it with an appropriate deployment strategy—Gunicorn with Eventlet or Gevent workers, or a standalone Eventlet/Gevent server.

Use it for:

  • Build real-time chat or notification systems in Flask without switching to a specialized async framework.
  • Add live data streaming or dashboard updates to existing Flask applications.
  • Implement collaborative editing or multiplayer features where clients need instant server-to-client messaging.
  • Create interactive debugging or monitoring tools that push status updates to connected clients.
  • Develop browser-based games or interactive applications requiring low-latency bidirectional communication.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds WebSocket support to Flask applications without requiring greenlet-based servers, working with the Flask development server and production deployments via Gunicorn, Eventlet, or Gevent.

Yes, if you need WebSocket support in Flask and want to avoid greenlet-based servers during development. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and uses a permissive MIT license. It's well-suited for adding real-time features to existing Flask projects without major architectural changes.

Install

flask-sock on PyPI

pip

pip install flask-sock

uv

uv add flask-sock

poetry

poetry add flask-sock

Installing flask-sock

Before you install

Low friction: pure Python wheel with only two runtime dependencies (flask and simple-websocket). Actively maintained with recent commits and no known vulnerabilities.

License in practice

MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.

Quickstart

pip install flask-sock

from flask import Flask
from flask_sock import Sock

app = Flask(__name__)
sock = Sock(app)

@sock.route('/echo')
def echo(ws):
    while True:
        data = ws.receive()
        ws.send(data)

Requires Python 3.6 or later; for production use, deploy with Gunicorn, Eventlet, or Gevent rather than the Flask development server.

Verify before relying

  • Whether the package's WebSocket implementation handles connection pooling or scales to high concurrency loads.
  • Performance characteristics compared to other Flask WebSocket extensions in production deployments.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 2 — flask, simple-websocket
Maintenance actively maintained — 1,047 days since the last release
Last repo commit
First released
Downloads 2,103,188/month — #3,294 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flask_sock-0.7.0-py3-none-any.whl

Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

flask websocket supportwebsocket extension for flaskreal-time communication flaskbidirectional web communicationflask ws serverwebsocket without geventflask socket connection
websocketreal-time-communicationflask-extension

More Dynamic Content packages