flask-websockets
flask-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.
flask-websockets supports most popular HTTP WSGI servers such as Werkzeug, Gunicorn, Eventlet and Gevent.
Example Usage
import time
from threading import Thread
from flask import Flask
from flask_websockets import WebSocket, WebSockets
app = Flask(__name__)
websockets = WebSockets(app)
@websockets.route("/ws")
def websocket_route(ws: WebSocket) -> None:
with websockets.subscribe(ws, ["server_time"]):
for data in ws.iter_data(): # keep listening to the websocket so it doesn't disconnect
pass
def publish_server_time() -> None:
while True:
websockets.publish(str(time.time()), ["server_time"])
time.sleep(1)
Thread(target=publish_server_time).start()
app.run(host="localhost", port=6969)
Metadata
Release files for flask-websockets 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask_websockets-0.1.2.tar.gz | 11.2 kB | Without provenance | Details for flask_websockets-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_websockets-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for flask_websockets-0.1.2-py3-none-any.whl |
Total release size: 20.7 kB
Release files / flask_websockets-0.1.2.tar.gz
| Download URL | flask_websockets-0.1.2.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d91e9272b74c5a9ab944b86e6ff71a71182e64263ff0bcca6989cca892d7ddb7
|
|
BLAKE2b-256 checksum How to use checksums |
2983f9e4ac95e9ce147f304edafac0a9a22f79d4730024c3b999a11d3985f86c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.17.1 CPython/3.12.4 Linux/6.5.0-1023-azure
|
Release files / flask_websockets-0.1.2-py3-none-any.whl
| Download URL | flask_websockets-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b645e8d7bd70792244e1cb8db1a4032f0f7503195e9be5274e6500c54546b1d9
|
|
BLAKE2b-256 checksum How to use checksums |
195bd3b9b610b318829ed74b97465abdd43c3c9414c064c423dc083b11cf958d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.17.1 CPython/3.12.4 Linux/6.5.0-1023-azure
|
Security for flask-websockets 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.