Common SignalA Rust router for binary protocols
wireframe is an experimental Rust library for building servers and clients for frame-based binary protocols. Frame the bytes, route messages by ID, and keep protocol behaviour open to inspection.

A common foundation for unfamiliar traffic. Every protocol brings its own rules. wireframe provides the framing and routing machinery, so an application can concentrate on the messages it handles.
- RoutingBy message ID, one handler each
- CodecsOne trait for any wire format
- MiddlewareWraps buffered routes
- ClientThe same codec and envelope, outbound
- Release
- 0.4.0-alpha1
- Status
- Alpha, unpublished
- Target
- 2 December 2026
- Rust
- 1.95 or newer
- Runtime
- Tokio
- Licence
- ISC
Three steps
-
1 Describe the messages
first_server.rsWorking example #[derive(bincode::Encode, bincode::BorrowDecode, Debug)] struct Ping { body: String, } #[derive(bincode::Encode, bincode::BorrowDecode, Debug, PartialEq)] struct Pong { body: String, } const PING: u32 = 1; -
2 Route and answer
first_server.rsWorking example fn build_app() -> wireframe::Result<WireframeApp> { let handler: Handler<Envelope> = Arc::new(|env: &Envelope| { let id = env.id(); Box::pin(async move { println!("routed message {id}") }) }); WireframeApp::new()?.route(PING, handler)?.wrap(AnswerPings) } -
3 Complexity, reduced

Plate 28 · Technical diagram Complexity, reduced. Framing, parsing, dispatch, and state, written by hand, give way to three named layers. A comparison, not a measurement.
Both panels are cut from the getting-started program, compiled and run against wireframe 0.4.0-alpha1 built from source at commit 9408f167 on 2026-12-02. A route handler returns nothing; the program’s middleware writes the Pong.
Frame. Route. Handle.
Follow the message. A codec identifies frame boundaries. The routing layer selects a handler by message ID. Middleware wraps buffered handlers. The reply retraces the way it came, and the architecture guide explains each boundary.
Fragment reassembly is a transport step and optional. Message assembly, for protocols that spread one message across several frames, is a separate step that runs after it.
The stack, layer by layer-
Input
Bytes off the socket
A Tokio TCP stream. A server that expects a preamble reads it first, under a 10-second deadline by default; without one, the connection goes straight to the application.
-
Framing
Cut at the length prefix
A FrameCodec decodes frames. The default reads a 4-byte big-endian length prefix and refuses frames over 1,024 bytes.
-
Envelope
Read the envelope
The serializer decodes an Envelope: a message ID, an optional correlation ID, and the payload bytes. Trailing bytes are a decoding error.
-
Reassembly Optional
Fragments, rejoined
With fragmentation enabled, fragments arrive inside envelopes and are rejoined before routing, bounded by size, by count, and by time.
-
Deflection
Route by message ID
One handler per ID. An ID with no route is logged and dropped; registering an ID twice fails at setup.
-
Modulation
Wrap the handler
Middleware wraps route and route_response handlers. A streaming_route handler performs its own authentication and validation.
-
Dwell
Handle the message
A route handler receives the envelope and returns nothing, so the default reply echoes the payload. A route_response handler returns a reply. A streaming_route handler receives the body in chunks.
-
Retrace
Serialize, frame, send
Every reply, streamed or not, keeps the request’s correlation ID and leaves through the connection’s actor: optional fragmentation, the serializer, the codec’s wrapper, the before_send hook, and the encoder.
What it carries
Any wire format, one trait
FrameCodec describes any wire format: how to cut frames, where the payload sits, and where a correlation ID lives.
- Hotline20-byte header, big-endian lengths, a transaction ID
- MySQL3-byte little-endian length, 1-byte sequence number
- RESPSimple strings, integers, bulk strings, and arrays
The default frame: a 4-byte big-endian length, then the payload. The three codecs above ship as worked examples.
Answer in middleware
A Transform wraps route and route_response handlers. Setup and teardown hooks carry per-connection state.
Push and streams, wired
Priority push queues, a session registry, and streamed or multi-packet replies, driven by the connection actor every WireframeServer connection owns.
One definition, both ends
WireframeClient correlates replies, reads streams, and pools reusable sockets, each opened on first use.
Test at the frame
Feed frames one byte at a time, fragment a payload, or pace a slow reader under paused time.

Large messages, bounded
Fragmentation, message assembly, and per-connection memory budgets that count fragment and assembly bytes together, slow reads at 80%, and close the connection past the cap.
Proposed · RFC 0007
Capacity is part of the design. A message leaving a queue has not necessarily left memory. The proposed budget contract accounts for retained data and admitted work by scope. Review the proposal

Already carrying traffic
mxd, df12’s Hotline server, depends on wireframe 0.3.0. Its transport adapter frames and routes the Hotline protocol; its domain crate never imports wireframe. Hotline’s framing ships with wireframe too, as a worked codec example.
Read about mxd- Protocol
- Hotline, 1990s Mac file sharing and chat
- Transport
mxd-wireframe-server, on wireframe 0.3.0- Boundary
- Wireframe types stop at the transport adapter
Add it to Cargo.toml
The sample crate’s dependencies, exactly as compiled, on Rust 1.95 or newer. pool and testkit are opt-in features; metrics and the bincode serializer are on by default.
[dependencies]
wireframe = { version = "=0.4.0-alpha1", features = ["pool", "testkit"] }
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "sync", "test-util", "time"] }
async-trait = "0.1.89"
bincode = "2.0.1"
bytes = "1.10.1"
futures = "0.3.31"
tokio-util = { version = "0.7.16", features = ["codec", "rt"] }
What we connect, we should understand.

