websockets
An implementation of the WebSocket Protocol (RFC 6455 & 7692)
Decision gist · record as of 2026-08-14
Yes. websockets is a mature, actively maintained library with zero known vulnerabilities, low install friction, permissive licensing, and strong community adoption (top 100 PyPI). Install it if you need RFC 6455–compliant WebSocket servers or clients in Python; skip it only if you need mixed HTTP/WebSocket support in a single server or prefer callback-based APIs.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Asyncio examples require an async-capable environment.
- Low install friction with a pure-wheel distribution.
License · maintenance · safety
BSD-3-Clause (permissive) — Released under BSD-3-Clause (permissive license), allowing commercial and private use with minimal restrictions.
last release 2026-07-31 (14 days) · last repo commit 2026-08-10 · 5,712 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 543,199,444 downloads/mo, #71 on PyPI
Alternatives
Verify before relying
pip install websockets
# Async server example
import asyncio
from websockets.asyncio.server import serve
async def echo(websocket):
async for message in websocket:
await websocket.send(message)
async def main():
server = await serve(echo, "localhost", 8765)
await server.serve_forever()
asyncio.run(main())- Performance benchmarks against other WebSocket libraries in production scenarios
- Specific memory usage characteristics under high concurrency loads
- Details on C extension availability and performance gains across platforms
What it is and what it does
websockets is a production-grade WebSocket implementation focused on RFC 6455 and RFC 7692 compliance. It provides coroutine-based APIs built on asyncio, with alternative threading and trio implementations for different concurrency models. The library handles connection management, backpressure, and protocol details so developers can focus on application logic.
The package is designed for pure WebSocket communication—not mixed HTTP/WebSocket servers. It emphasizes correctness through comprehensive testing, simplicity in its API surface, robustness for production deployments, and performance through memory optimization and optional C acceleration. It's widely used and actively maintained, with no known security vulnerabilities.
Use it for
- Build real-time chat or notification servers using asyncio coroutines
- Create bidirectional communication channels for live data streaming or dashboards
- Implement WebSocket clients in Python applications for connecting to remote services
- Integrate WebSocket support into third-party projects via the Sans-I/O layer
- Add WebSocket endpoints to existing asyncio or threading-based applications
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
websockets is a mature, actively maintained library with zero known vulnerabilities, low install friction, permissive licensing, and strong community adoption (top 100 PyPI). Install it if you need RFC 6455–compliant WebSocket servers or clients in Python; skip it only if you need mixed HTTP/WebSocket support in a single server or prefer callback-based APIs.
Install
websockets on PyPI
Before you install
Low install friction with a pure-wheel distribution. Active maintenance with a recent release 14 days ago and continuous repository activity. Supports current Python versions (3.11–3.15).
Requires Python 3.11 or later. Asyncio examples require an async-capable environment.
License in practice
Released under BSD-3-Clause (permissive license), allowing commercial and private use with minimal restrictions.
Quickstart
pip install websockets
# Async server example
import asyncio
from websockets.asyncio.server import serve
async def echo(websocket):
async for message in websocket:
await websocket.send(message)
async def main():
server = await serve(echo, "localhost", 8765)
await server.serve_forever()
asyncio.run(main())
Verify before relying
- Performance benchmarks against other WebSocket libraries in production scenarios
- Specific memory usage characteristics under high concurrency loads
- Details on C extension availability and performance gains across platforms
Package 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 14 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 543,199,444 / month, #71 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15 |
Evidence: websockets-17.0.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “asyncio websocket library”
- websocketswebsockets is a library for building WebSocket servers and clients in…
- aiosonicAn asyncio HTTP/1.1, HTTP/2, and WebSocket client library with…
- centrifuge-pythonWebSocket real-time client SDK for Centrifugo and Centrifuge-based…
Give your agent the search over MCP, or paste the wish link into any chat.
More WWW/HTTP packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
h11 is a pure-Python HTTP/1.1 protocol implementation that handles parsing and serializing HTTP messages without any built-in I/O, letting you integrate it with any network layer you choose.
HTTPX is a fully featured HTTP client library for Python that provides both sync and async APIs, with support for HTTP/1.1 and HTTP/2, plus an integrated command-line client.
Install it if you are building new projects or modernizing existing ones that rely on HTTP.
A minimal low-level HTTP client library that sends HTTP requests with thread-safe and task-safe connection pooling, supporting HTTP/1.1, HTTP/2, proxies, and both sync and async interfaces.
aiohttp is an async HTTP client and server framework built on asyncio, supporting both WebSockets and middleware-based routing for building concurrent web applications.
Install it if you need async HTTP client or server capabilities in asyncio-based applications.
See also trio-websocket · websocket-client · ws4py · lomond · asyncore-wsgi · httpx-ws · tornado · websockets-proxy · wsproto · moonraker-api