--- id: httpx-ws version: "0.9.0" license: unclear license_treatment: permissive maintenance: active --- # httpx-ws — WebSockets support for HTTPX License: permissive · Maintenance: active · Downloads: 11.3M/mo ## What it is and what it does httpx-ws extends HTTPX with WebSocket protocol support, allowing developers to establish and manage WebSocket connections using the same client interface they use for HTTP requests. It provides both synchronous and asynchronous APIs, with convenience methods for sending and receiving text, binary, or JSON payloads. The package handles protocol-level details such as automatic ping/pong responses and optional keepalive pings, and includes an HTTPX transport for testing WebSocket endpoints defined in ASGI applications. The package builds on httpx, httpcore, anyio, and wsproto, supporting Python 3.10 through 3.14 and both asyncio and Trio async backends through anyio. It is actively maintained and widely used, though still in Beta status, making it suitable for production use cases where WebSocket support is needed alongside HTTP in a unified client. Use it for: - Building real-time chat or notification clients that communicate over WebSockets while using HTTPX for initial authentication or REST calls. - Testing ASGI-based WebSocket endpoints in unit tests using the HTTPX transport without spinning up a live server. - Creating async applications that need to maintain long-lived WebSocket connections with automatic keepalive and ping/pong handling. - Sending and receiving structured JSON data over WebSocket connections with minimal boilerplate. - Migrating existing HTTPX-based clients to support bidirectional communication without switching HTTP libraries. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds WebSocket support to HTTPX, enabling sync and async WebSocket client connections with helper methods for sending and receiving text, binary, and JSON data. Yes. httpx-ws is actively maintained, has low install friction, carries no known vulnerabilities, and is widely downloaded. It is the natural choice if you already use HTTPX and need WebSocket support. The Beta status reflects maturity rather than instability—it is suitable for production use. ## Install pip install httpx-ws uv add httpx-ws poetry add httpx-ws ## Installing httpx-ws Before you install: Low install friction with a pure-Python wheel distribution. Actively maintained as of 2026-08-12 with recent releases; rated Beta status but in the top 5000 PyPI packages by download volume. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations. Quickstart: pip install httpx-ws import httpx import httpx_ws async with httpx.AsyncClient() as client: async with httpx_ws.aconnect_ws('wss://example.com/ws', client=client) as ws: await ws.send_text('Hello') data = await ws.receive_text() Requires Python 3.10 or later; asyncio or Trio runtime for async operations. Verify before relying: - Whether automatic keepalive ping is configurable or always enabled by default. - Performance characteristics under high-concurrency or high-throughput WebSocket scenarios. - Compatibility with specific ASGI frameworks beyond the general ASGI transport testing claim. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 11.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags websocket client library, httpx websocket support, async websocket python, websocket text binary json, httpx ws integration, websocket keepalive ping, asgi websocket testing, websocket-client, async-http [View on SkillFed](https://skillfed.io/packages/httpx-ws) · [View on PyPI](https://pypi.org/project/httpx-ws/)