{"id":23071254,"url":"https://github.com/ch-iv/flask-websockets","last_synced_at":"2026-04-29T20:03:35.071Z","repository":{"id":247141168,"uuid":"823418552","full_name":"ch-iv/flask-websockets","owner":"ch-iv","description":"WebSockets extension with channels for Flask","archived":false,"fork":false,"pushed_at":"2024-07-19T21:58:31.000Z","size":212,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-20T14:15:57.138Z","etag":null,"topics":["flask","flask-websockets","python","websocket","websockets"],"latest_commit_sha":null,"homepage":"https://flaskwebsockets.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ch-iv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-03T02:16:39.000Z","updated_at":"2025-02-02T17:08:02.000Z","dependencies_parsed_at":"2024-07-16T06:53:22.011Z","dependency_job_id":null,"html_url":"https://github.com/ch-iv/flask-websockets","commit_stats":null,"previous_names":["ch-iv/flask-websockets"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch-iv%2Fflask-websockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch-iv%2Fflask-websockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch-iv%2Fflask-websockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch-iv%2Fflask-websockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ch-iv","download_url":"https://codeload.github.com/ch-iv/flask-websockets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244695249,"owners_count":20494790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","flask-websockets","python","websocket","websockets"],"created_at":"2024-12-16T07:12:09.902Z","updated_at":"2026-04-29T20:03:25.059Z","avatar_url":"https://github.com/ch-iv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flask-websockets\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ch-iv/flask-websockets/ci.yml?style=flat\u0026logo=github\u0026label=Tests%20%26%20Linting)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ch-iv/flask-websockets/publish.yml?style=flat\u0026logo=github\u0026label=Latest%20Release)\n[![Documentation Status](https://readthedocs.org/projects/flaskwebsockets/badge/?version=latest)](https://flaskwebsockets.readthedocs.io/en/latest/?badge=latest)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-websockets)\n[![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json\u0026labelColor=202235)](https://github.com/astral-sh/ruff)\n[![code style - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json\u0026labelColor=202235)](https://github.com/astral-sh/ruff)\n\nflask-websockets is an extension library for Flask, a popular web micro-framework. It adds real-time communication capabilities to your Flask application. flask-websockets implements the WebSocket protocol and allows for low-level control over the connections, as well as a high-level API for subscribing connections to rooms.\n\nflask-websockets supports most popular HTTP WSGI servers such as Werkzeug, Gunicorn, Eventlet and Gevent.\n\n## Example Usage\n```python\nimport time\nfrom threading import Thread\nfrom flask import Flask\nfrom flask_websockets import WebSocket, WebSockets\n\napp = Flask(__name__)\nwebsockets = WebSockets(app)\n\n\n@websockets.route(\"/ws\")\ndef websocket_route(ws: WebSocket) -\u003e None:\n    with websockets.subscribe(ws, [\"server_time\"]):\n        for data in ws.iter_data():    # keep listening to the websocket so it doesn't disconnect\n            pass\n\n\ndef publish_server_time() -\u003e None:\n    while True:\n        websockets.publish(str(time.time()), [\"server_time\"])\n        time.sleep(1)\n\n\nThread(target=publish_server_time).start()\napp.run(host=\"localhost\", port=6969)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fch-iv%2Fflask-websockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fch-iv%2Fflask-websockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fch-iv%2Fflask-websockets/lists"}