A WebSocket replacement built on HTTP/3 and QUIC.
Async Python server framework for HTTP/3 + WebTransport (QUIC).
What WebSocket would look like if it was designed today.
from http3x import App
from http3x.wt import Session
app = App()
class Echo(Session):
async def on_stream(self, stream):
async for data in stream:
await stream.send(data)
app.wt.add("/echo", Echo)
app.run(host='::', port=4433, certfile="cert.pem", keyfile="key.pem")pip install http3xStreaming AI-style responses over HTTP/3 (WebTransport):
You: hello
AI:
h
he
hel
hell
hello 👋
This is NOT WebSocket.
This is native HTTP/3 streaming over QUIC.
See tests/wt_chat_stream.py and tests/wt_chat_stream.html for the complete example.
| Feature | WebSocket | http3x |
|---|---|---|
| Protocol | TCP | QUIC (HTTP/3) |
| Streams | Single stream | Multiplexed streams |
| Datagram | No support | Built-in datagram |
| Head-of-line blocking | Yes | No |
Simple HTTP/3 server with GET and POST endpoints:
from http3x import App
from http3x.h3 import Handler
app = App()
class ApiHandler(Handler):
async def get(self):
return {'status': 'ok'}
async def post(self):
return {'status': 'ok'}
app.h3.add('/h3', ApiHandler)
app.run(host='0.0.0.0', port=443, certfile="cert.pem", keyfile="key.pem")Using curl with HTTP/3 support:
curl --http3-only -k https://localhost:443/h3
curl --http3-only -k -X POST -d "Hello, HTTP/3!" https://localhost:443/h3See tests/h3_mini.py for the complete example.
- HTTP/3 server (QUIC-based)
- WebTransport (stream + datagram)
- Multiplexed streams (no head-of-line blocking)
- Async/await API
- Built on aioquic
- WebTransport Guide - Complete documentation for WebTransport functionality
- HTTP/3 Guide - Complete documentation for HTTP/3 functionality
More docs coming soon.
- Source Code: GitHub Repository
- Documentation: Http3x Documentation
- PyPI: http3x
- Contributors: GitHub Contributors
Contributions are welcome! Please visit the GitHub repository to contribute code, report issues, or suggest features.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
