skillfed

httpx-ws

WebSockets support for HTTPX

httpx-ws v0.9.0 11.3M downloads/30d#1,398 on PyPI152
Permissive license Active released

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 on this page — 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

httpx-ws on PyPI

pip

pip install httpx-ws

uv

uv add httpx-ws

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 4 — anyio, httpcore, httpx, wsproto
Maintenance actively maintained — 139 days since the last release
Last repo commit
First released
Downloads 11,327,645/month — #1,398 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: httpx_ws-0.9.0-py3-none-any.whl

Development Status :: 4 - BetaFramework :: AsyncIOIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet :: WWW/HTTP :: Session

Tags

websocket client libraryhttpx websocket supportasync websocket pythonwebsocket text binary jsonhttpx ws integrationwebsocket keepalive pingasgi websocket testing
websocket-clientasync-http

More Session packages

Flask-Session

Flask-Session adds server-side session storage…

permissive · top 5,000 on PyPI

fastapi-users

Provides ready-to-use user registration, login,…

permissive · top 5,000 on PyPI

fastapi-users-db-sqlalchemy

Provides a SQLAlchemy ORM adapter for FastAPI…

permissive · top 5,000 on PyPI

django-rest-knox

Provides token-based authentication for Django…

permissive · top 5,000 on PyPI

supertokens-python

Interfaces a Python API with the SuperTokens…

permissive · top 15,000 on PyPI

starlette-csrf

Starlette middleware that protects web…

permissive · top 15,000 on PyPI

httpx-oauth

Provides an async OAuth client built on HTTPX…

permissive · top 5,000 on PyPI

websockets-proxy

Enables WebSocket connections through HTTP and…

permissive · top 15,000 on PyPI

bottle-websocket

Adds WebSocket support to the Bottle web…

permissive · top 15,000 on PyPI

websockets

websockets is a library for building WebSocket…

permissive · top 100 on PyPI

aiosonic

An asyncio HTTP/1.1, HTTP/2, and WebSocket…

permissive · top 15,000 on PyPI

httpx-socks

Adds SOCKS4(a), SOCKS5(h), and HTTP CONNECT…

permissive · top 5,000 on PyPI

websocket-client

websocket-client provides a Python WebSocket…

permissive · top 1,000 on PyPI

websockify

Translates WebSocket connections to normal TCP…

copyleft · top 15,000 on PyPI

samsungtvws

A Python library for remotely controlling…

copyleft · top 15,000 on PyPI

aiohttp-asgi-connector

Provides an AIOHTTP connector that lets you…

permissive · top 15,000 on PyPI