Skip to content
wireframe home
Menu
Plate 26 · Civic setting The common signal. Bridges and civic landmarks link a multicoloured cityscape. The title image of the Common Signal series.

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.

Plate 18 · Civic setting Civic sphere. A geodesic shell encloses an illuminated skyline, with signals arriving from outside. Civic setting for the Common Signal series.

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.

Five sources, numbered in priority order, shutdown, high priority, low priority, multi-packet, and response stream, feed a box labelled biased select, which sends one ordered output. Beneath: fairness, one low after eight high.
Plate 31 · Technical diagram The connection actor. One task per connection takes from five sources in a fixed order and writes one ordered output. Shutdown is heard first; fairness lets a low-priority frame through after eight high-priority ones. In 0.4.0-alpha1, every server connection runs one, with the default fairness.
Plate 09 · Concept artwork Queued frames. Frames wait their turn on the avenue, in plain sight, instead of piling up somewhere nobody is counting. Concept artwork for bounded queues. The cubes are not counted frames.

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.

A push handle feeds a full bounded queue, labelled push: waits for room, then a rate limit of 100 per second, labelled then a permit, and on to the actor. Below, try_push: no wait branches to rate limited, return error, drop, and warn and drop; both drops lead to dead letters, if configured.
Plate 32 · Technical diagram Push queues. A push waits for room and then for the rate limiter. A try_push never waits: without a permit it is refused, and against a full queue its policy returns an error, drops, or warns and drops; a dropped frame goes to the dead-letter queue if there is one. In 0.4.0-alpha1, on every server connection through with_push_queues.
Plate 13 · Concept artwork Guarded core. A magenta core sits inside a protective blue mesh. Concept artwork. It stands for a bounded reserve, not for any measured amount.

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.

Three gauges: per message, 16 KiB; per connection, 64 KiB; in flight, 64 KiB. The per-message gauge ends in a red mark, labelled over: message rejected. The other two turn yellow at 80%, labelled reads pause, and end in red, labelled over: close.
Plate 15 · Technical diagram Memory budgets. Three caps on what one connection may buffer. Past the per-message cap a message is rejected; at 80% of the smaller aggregate cap reads pause; past it, the connection closes. In 0.4.0-alpha1. Defaults for the 1,024-byte frame limit; the needles are illustrative.
Plate 12 · Concept artwork Inside the channel. Parallel paths converge inside a cylindrical lattice. Concept artwork. It illustrates a channel, not a particular codec.

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.

A segmented gauge of buffered bytes, labelled fragment and assembly bytes, counted together, fills green to a yellow soft limit at 80% and ends at a red hard cap. Below it: below 80%, read on; at 80%, pause 5 ms per read; over the cap, close.
Plate 17 · Technical diagram Buffer pressure. Fragment and assembly bytes share one gauge. Below the soft limit, reading carries on; at it, each read waits 5 ms; over the hard cap, the connection closes. In 0.4.0-alpha1. The fill level is illustrative.
Plate 16 · Concept artwork The bounded passage. A cube travels an octagonal passage; as it leaves, the beam draws the next at the entrance. Concept artwork. The passage stands for the frame limit, not a measured size.

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.

Plate 22 · Civic setting Service interchange. Coloured service routes cross on separate decks. Civic setting for the Common Signal series.

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

A peer sends to a reader inside one session, which passes to bounded work, then to bounded queues, then to a sole writer that sends back to the peer. Cancellation and deadlines sit beside them. Beneath: reads advance while writes wait.
Plate 33 · Technical diagram Duplex session driver. One session owns its reader, its only writer, and bounded work, so reading carries on while a write or a handler waits. Proposed · RFC 0004. None of it has a runtime in 0.4.0-alpha1.
Plate 04 · Civic setting The threshold. Traffic runs along a lit road, through a gate, and on towards the horizon. Civic setting for the Common Signal series.

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

Phase transition. A red flush barrier divides an old phase from a new one across three lanes: encoded frames are flushed first; accepted work that was not encoded is cancelled and may be retried; unread bytes are handed over once.
Plate 10 · Technical diagram Flush barrier. Before a protocol changes phase, everything already encoded is written out, anything accepted but not yet encoded is cancelled, and unread bytes pass to the new phase exactly once. Proposed · RFC 0005. None of it has a runtime in 0.4.0-alpha1.
Plate 30 · Civic setting Transit panorama. Packets travel the interchange as the view pulls back to the whole network. Civic setting. The packets are illustration, not traffic data.

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.