websockets
An implementation of the WebSocket Protocol (RFC 6455 & 7692)
Install
websockets on PyPI
pip
pip install websocketsuv
uv add websocketspoetry
poetry add websocketsPackage facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 13 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the 100 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: websockets-17.0.1-py3-none-any.whl
Keywords: WebSocket
About websockets
from the package's own PyPI description — quoted content, verbatim
.. image:: logo/horizontal.svg :width: 480px :alt: websockets
|licence| |version| |pyversions|
.. |licence| image:: https://img.shields.io/pypi/l/websockets.svg :target: https://pypi.python.org/pypi/websockets
.. |version| image:: https://img.shields.io/pypi/v/websockets.svg :target: https://pypi.python.org/pypi/websockets
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/websockets.svg :target: https://pypi.python.org/pypi/websockets
What is websockets?
websockets is a library for building WebSocket_ servers and clients in Python with a focus on correctness, simplicity, robustness, and performance.
.. _WebSocket: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
Built on top of asyncio, Python's standard asynchronous I/O framework, the
default implementation provides an elegant coroutine-based API.
Implementations on top of threading and trio are also provided, as well
as a Sans-I/O layer for integration in third-party projects.
Documentation is available on Read the Docs. <https://websockets.readthedocs.io/>_
.. copy-pasted because GitHub doesn't support the include...
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
websockets is a library for building WebSocket servers and clients in Python with asyncio, threading, and trio support, emphasizing correctness, simplicity, robustness, and performance.
Low install friction with zero runtime dependencies and a pure-wheel distribution (websockets-17.0.1-py3-none-any.whl). Active maintenance with a release 13 days ago and last commit on 2026-08-10.
Released under BSD-3-Clause (permissive license), allowing commercial and private use with minimal restrictions beyond attribution and liability disclaimers.
Usage
pip install websockets
import asyncio
from websockets.asyncio.server import serve
async def echo(websocket):
async for message in websocket:
await websocket.send(message)
asyncio.run(serve(echo, "localhost", 8765))
Requires Python 3.11 or later; asyncio example requires async/await support.
Verdict: websockets is a production-ready, actively maintained WebSocket implementation with zero dependencies, permissive licensing, and strong RFC 6455 compliance. It ranks in the top 100 PyPI packages with no known vulnerabilities and supports Python 3.11–3.15, making it a low-friction choice for WebSocket applications.
Needs verification
- Whether the C extension for performance optimization is automatically compiled or requires system dependencies during installation.
- Specific performance characteristics and memory overhead compared to callback-based alternatives in production scenarios.
Similar packages
permissive · top 1,000 on PyPI
websocket-clientpermissive · top 1,000 on PyPI
tornadopermissive · top 1,000 on PyPI
cbor2permissive · top 1,000 on PyPI
simple-websocketpermissive · top 1,000 on PyPI
terminadopermissive · top 1,000 on PyPI
trio-websocketpermissive · top 1,000 on PyPI
uvicornpermissive · top 100 on PyPI
backports.asyncio.runnerpermissive · top 1,000 on PyPI
anyiopermissive · top 100 on PyPI