Pydantic's HTTPX2 adds native WebSocket and SSE support
samuelcolvin · x · 2026-10-16
Pydantic's HTTPX2 client now speaks WebSockets and Server-Sent Events out of the box:
- New client.websocket() and client.sse() methods work on the existing client, with headers, cookies, auth, proxies and timeouts applying as usual; both sync and async APIs are supported.
- WebSocket support requires the optional wsproto dependency (pip install "httpx2[ws]"); client.websocket() is a context manager that performs the handshake, yields a WebSocketSession, supports ws:// and wss://, and closes automatically on exit.
- client.sse() returns an iterable event stream exposing event.event and event.data.
More from coding & agent
- Satire: 19 Claude agents 'reverse-engineer' Blender, forgetting it's already open source — Dan_Jeffries1 · 2026-10-16
- Engineers Should Mine Gong Calls for Ideas That Never Became Tickets — curious_vii · 2026-10-16
- One 80-Word Prompt, Overnight AI Agent Built a Site With 205 Bakeries Mapped — jamesbrooksco · 2026-10-16
- Visual Lean: drag-and-drop GUI for the Natural Numbers Game runs Lean 4 in WASM — MilesCranmer · 2026-10-16
- Fine-Tuned 0.6B Router Beats Its 27B Sibling: Small Specialized Models Win — mshubham · 2026-10-16
- Engineering Leader: AI Got Me Coding Again — I Built Our Feature-Flag System With an Agent — rseroter · 2026-10-16