
Common Signal · seven public works
Keeping the commons
A connection is shared ground. A peer’s requests, the server’s replies, a background task’s notices, and the order to close all cross one socket, and each would happily take the whole road.
A protocol server is a small public works department. It keeps traffic moving, puts its rules where people can read them, and does not let the loudest user decide for everyone. This is how wireframe keeps that ground, told as a city. Each chapter ends by saying what ships in 0.4.0-alpha1 and what is still a proposal.

I · The connection actor
One steward per street
Every connection gets a steward: a ConnectionActor, one task that owns everything the connection says. It listens to five sources in a fixed order, the order to shut down first, then high-priority pushes, low-priority pushes, a multi-packet channel, and the current response, and writes them as one ordered stream. There is no second writer to slip half a frame into the middle of another.
A fixed order alone would let the urgent starve the routine. On a server connection, a low-priority frame gets through after at most eight high-priority ones; an actor driven by hand can tune that, and add a time slice, through FairnessConfig.
Status In 0.4.0-alpha1, every server connection runs one.


II · Back-pressure
Queues at the lights
When the road ahead is full, a well-run city makes traffic wait where everyone can see it, not in a basement nobody audits. wireframe’s queues are bounded. Response::with_channel hands a producer a sender whose send waits while the channel is full, so a slow reader slows the producer instead of growing a buffer.
Pushes wait too. push_high_priority and push_low_priority wait for room, and then for the rate limiter, 100 pushes a second by default. try_push never waits. With no permit it refuses with RateLimited; with a full queue its PushPolicy returns an error, drops the frame, or warns and drops it, and a dropped frame goes to the dead-letter queue if one is configured. Without one, DropIfFull loses the frame with only a count in wireframe_push_drops_total to show for it. That is a policy; choose it on purpose.
Status Both ship in 0.4.0-alpha1, and the server uses both: handlers stream through route_response, and with_push_queues gives every connection its own queues.


III · Memory budgets
The reservoir and its gauges
A partial message is water held behind a dam. A peer can leave message after message unfinished, each holding bytes in memory. MemoryBudgets caps the size of one message, bytes held by the connection, and bytes in flight.
Left unset, the caps derive from the frame limit: 16, 64, and 64 KiB for the default 1,024-byte frame. The message cap counts metadata and body together. An oversized buffered message is rejected before dispatch. A streaming handler may already have read earlier chunks when a later chunk crosses the cap.
Status In 0.4.0-alpha1. Fragmentation, message assembly, and streaming request bodies all use these budgets.


IV · Pressure
Two marks on the gauge
A dam with only a burst limit is not engineering. At 80% of the smaller aggregate cap, the connection waits 5 ms before each read. The sender feels it as a slower socket, which is the oldest back-pressure there is. Past the cap, the connection closes.
Fragment and assembly bytes fill the same gauge, alongside queued body chunks and completed messages waiting behind a streaming request. Fragments still count with message assembly off.
Status In 0.4.0-alpha1.


V · Fragmentation
Nothing wider than the passage
Every frame has a limit, 1,024 bytes by default. Fragmentation lets a larger message through by cutting it into fragments that fit, each its own frame, and rejoining them before protocol message assembly.
enable_fragmentation() derives the rest from the frame limit: messages up to sixteen frames’ worth, partial messages evicted after 30 seconds, and caps on how much a peer may leave unfinished. Exceed those caps and the connection closes.
Status In 0.4.0-alpha1, off by default. Both ends must speak the format, and WireframeClient does not.

VI · Proposed: a duplex session
Two decks, one writer
A routed connection in 0.4.0-alpha1 dispatches one request at a time. A live request body or reply keeps the next request waiting. Some protocols cannot live like that. An agent may need to send its own requests while the host’s prompt is still pending.
RFC 0004 proposes a duplex session driver: one session that owns its reader, its only writer, bounded queues, and bounded child work, and keeps reading while a write or a handler waits. Admission reserves item, byte, and work capacity before it accepts anything. A graceful close stops new work and drains only what was already accepted, before a deadline.
Proposed RFC 0004. None of it has a runtime in 0.4.0-alpha1. Review the proposal


VII · Proposed: phase transitions
Changing the guard
Some protocols change their rules in the middle of a conversation: a TLS upgrade, or a move from untagged start-up to tagged frames. Swap the parser at the wrong moment and bytes already buffered are lost or misread.
RFC 0005 proposes that a phase transition wait at a flush barrier the session’s writer owns. Everything already encoded is written out first. Work that was accepted but not yet encoded is cancelled, and may be retried under the new rules. Unread bytes pass to the new phase exactly once.
Proposed RFC 0005. None of it has a runtime in 0.4.0-alpha1. Review the proposal


Coda
What we connect, we should understand.
None of this is clever. Bounded queues, gauges anyone can read, one writer, a fixed order, a barrier before the rules change: the habits that keep a city’s water clean and its trains on time. They are written down so that anyone can check them.
