H3X is a lightweight QUIC-powered protocol for structured events with authentication, durable queues, and at-least-once delivery. Built with quinn, tokio, prost, and sled.
Status: Alpha. Core loop (Auth → FetchEvents → EventsBatch → AckEvent) works. In progress: batching, reconnect/backoff, stream-ID routing, JS/TS SDK.
- QUIC streams (TLS by default), multiplexed I/O
- Length-prefixed Protobuf frames (versionable)
- sled-backed queue for durable replay
- Namespaced auth:
client:{namespace}+ token registry - Explicit reliability via
AckEvent - Stream-ID routing scaffold (handlers per stream)
- Rust (stable), OpenSSL
- Windows:
rustup component add rust-src(if IDE/builds complain)
| Field | Type | Meaning |
|---|---|---|
frame_type |
u8 |
Discriminant |
payload_length |
u32 (LE) |
Length in bytes |
payload_bytes |
[length] |
Raw payload bytes |
- Auth:
{ client_id, token, namespaces[] } - FetchEvents:
{ namespaces[], limit? } - EventsBatch:
{ events[] } - AckEvent:
{ event_ids[] } - (Planned) SendEvent, RateLimitNotice, Ping, Pong
- Client → Auth
- Server → validate via
H3X_REGISTRY - Client → FetchEvents
- Server → EventsBatch
- Client → AckEvent for delivered IDs
message EventPayload {
string id = 1; // UUID v4
string namespace = 2; // e.g., "env_namespace"
string type = 3; // e.g., "Error"
string message = 4; // short description
bytes data = 5; // JSON or arbitrary bytes
int64 timestamp = 6; // Unix seconds (UTC)
map<string, string> metadata = 7;// severity, service, env, ...
}.
├─ Cargo.toml
├─ build.rs # prost-build (generates src/protocol/*)
├─ proto/ # .proto sources
├─ src/
│ ├─ server/ # QUIC server, handlers, queue, registry
│ ├─ client/ # run_client, builder, reconnect (WIP)
│ ├─ protocol/ # prost-generated Rust
│ ├─ state/ # server state (registry, queue)
│ └─ utils/ # framing (u8 + u32 LE + bytes)
├─ data/ # sled database (runtime)
└─ .env.example
Auth fails / stream closes
- Ensure
H3X_REGISTRYhas matchingclient:{namespace}={token}.
Always 0 events
- Check
H3X_DATA_DIRand keys likeenv_namespace:{uuid}exist in sled.
ApplicationClosed / BI stream error
- Often benign if the client exits after acks during dev; keep client running.
## Roadmap
- [x] Auth, FetchEvents, EventsBatch, AckEvent
- [x] sled-backed queue
- [x] Stream-ID routing scaffold
- [ ] Client reconnect + backoff
- [ ] Server batching & per-namespace rate limiting
- [ ] JS/TS SDK
- [ ] CLI: `h3x inject`, `h3x tail`, `h3x bench`
- [ ] Metrics (Prometheus)
## License
MIT