Skip to main content

A modern async server framework for HTTP/3 and WebTransport over QUIC.

Project description

HTTP3X

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.

🚀 Quick Example

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")

Installation

pip install http3x

🚀 WebTransport Live Example

Streaming 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.

HTTP3X AI Streaming Example

See tests/wt_chat_stream.py and tests/wt_chat_stream.html for the complete example.

⚡ Why not WebSocket?

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

🚀 HTTP/3 Live Example

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/h3

See tests/h3_mini.py for the complete example.

Features

  • HTTP/3 server (QUIC-based)
  • WebTransport (stream + datagram)
  • Multiplexed streams (no head-of-line blocking)
  • Async/await API
  • Built on aioquic

Documentation

More docs coming soon.

Project Links

Contributing

Contributions are welcome! Please visit the GitHub repository to contribute code, report issues, or suggest features.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

http3x-0.2.0.tar.gz (79.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

http3x-0.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file http3x-0.2.0.tar.gz.

File metadata

  • Download URL: http3x-0.2.0.tar.gz
  • Upload date:
  • Size: 79.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for http3x-0.2.0.tar.gz
Algorithm Hash digest
SHA256 393fd078ad480e272aab0dc70ca2d3d3d2e5173cc6aa93a8cca6530d737146e5
MD5 a34847b05e2930b3141628247ad18d12
BLAKE2b-256 826efc8ef20f5db62bd3210a5ec406b9eb3a4b3eef4ef7c8da2db9a612fd49bb

See more details on using hashes here.

File details

Details for the file http3x-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: http3x-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for http3x-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e5750bcd5cbe28d8a15123c30b13ffcdb006065dc7dab50138311427eb8bb1b
MD5 c9bbc7d68916b9ca3504c527fa0c0807
BLAKE2b-256 e78d569d6f4b862e18a1529568aa5124e4d6f66c2b56f0f003a803cceb88deaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page