websocket-client
WebSocket client for Python with low level API options
Decision gist · record as of 2026-08-14
Yes. websocket-client is a well-maintained, widely-used library (top 1000 PyPI packages) with low install friction, no required dependencies, permissive licensing, and active development. It solves a core need—WebSocket communication in Python—with both simple and advanced APIs. Install it if you need to connect to any WebSocket server; the only gotcha is that RFC 7692 compression is not supported, which rarely matters in practice.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- For automatic reconnection with run_forever, the rel package is recommended but not required.
- Low install friction with a pure-Python wheel distribution.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 is a permissive license allowing commercial and private use with minimal restrictions, making this package suitable for most projects without licensing concerns.
last release 2025-10-07 (311 days) · last repo commit 2026-05-04 · 3,711 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 232,092,465 downloads/mo, #175 on PyPI
Alternatives
Verify before relying
pip install websocket-client
from websocket import create_connection
ws = create_connection("ws://echo.websocket.events/")
ws.send("Hello, World")
print(ws.recv())
ws.close()- Whether permessage-deflate compression support (RFC 7692) is planned or if this remains a permanent limitation.
- Current state of threading support and whether documented best practices exist beyond the noted minimal documentation.
What it is and what it does
websocket-client is a mature Python library that implements the WebSocket protocol (hybi-13) to enable real-time, bidirectional communication between a Python client and WebSocket servers. It provides both low-level socket APIs for fine-grained control and higher-level abstractions like WebSocketApp for event-driven connection management with automatic reconnection capabilities.
The library is designed for two main usage patterns: short-lived connections for single request-response exchanges, and long-lived connections that maintain persistent communication with automatic reconnection on network failure. It has no required runtime dependencies, installs as a pure Python wheel, and supports current Python versions (3.9+) across all major platforms. Performance can be optionally enhanced by installing wsaccel, which the library will detect and use automatically.
Use it for
- Build real-time chat or notification systems that maintain persistent connections to a WebSocket server.
- Connect to live financial data feeds or cryptocurrency market data streams with automatic reconnection.
- Implement IoT device communication where a Python client needs to receive and send messages over WebSocket.
- Create monitoring dashboards that push live updates to clients via WebSocket connections.
- Test WebSocket server implementations by writing client code that validates protocol compliance.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
websocket-client is a well-maintained, widely-used library (top 1000 PyPI packages) with low install friction, no required dependencies, permissive licensing, and active development. It solves a core need—WebSocket communication in Python—with both simple and advanced APIs. Install it if you need to connect to any WebSocket server; the only gotcha is that RFC 7692 compression is not supported, which rarely matters in practice.
Install
websocket-client on PyPI
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with recent commits and a large user base (top 1000 PyPI packages). Supports Python 3.9+ across macOS, Windows, and POSIX systems.
Requires Python 3.9 or later. For automatic reconnection with run_forever, the rel package is recommended but not required.
License in practice
Apache-2.0 is a permissive license allowing commercial and private use with minimal restrictions, making this package suitable for most projects without licensing concerns.
Quickstart
pip install websocket-client
from websocket import create_connection
ws = create_connection("ws://echo.websocket.events/")
ws.send("Hello, World")
print(ws.recv())
ws.close()
Verify before relying
- Whether permessage-deflate compression support (RFC 7692) is planned or if this remains a permanent limitation.
- Current state of threading support and whether documented best practices exist beyond the noted minimal documentation.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 311 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 232,092,465 / month, #175 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: InternetTopic :: Software Development :: Libraries :: Python Modules |
Evidence: websocket_client-1.9.0-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 › “hybi-13 protocol implementation”
- websocket-clientwebsocket-client provides a Python WebSocket client implementing the…
- daveyImplements the Discord Audio & Video End-to-End Encryption (DAVE)…
- smpSerializes and deserializes the Simple Management Protocol (SMP),…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also obs-websocket-py · websockets · pysignalr · zwave-js-server-python · centrifuge-python · gevent-websocket · wsproto · websockets-proxy · ws4py · Pysher