Attaching
A client attaches to a channel by opening its live connection, and from then on the Core counts it, knows who it is, and watches whether it is still there. A channel declares how many clients it admits. Who the client is comes from the class of the channel's address, never from anything the client says. On attaching, the client is first given a picture of what it may see. This page gives cardinality, how the client is established, the opening picture, what ends an attachment, and how a client shows it is still current.
The live connection is the typed projection's stream, or /v1/events in the browser projection.
How many clients
Cardinality is declared per channel, and has no default.
clients | The channel admits | A further connection |
|---|---|---|
single | one client | refused with channel.in_use, naming nothing about who holds it |
multiple | as many as connect | accepted |
- A single-client channel refuses the second connection and never displaces the first.
- Cardinality and arbitration compose without interacting: cardinality decides how many clients may hold one channel, arbitration decides which channels may act while others are live, and the grade of a suspension decides what a losing channel keeps.
Who the client is
What establishes the client is the class of the channel's address, and never anything the client states.
| Class | Established from | If nothing establishes one |
|---|---|---|
| local socket | the kernel's peer credential, resolved through the host's account database | — |
| loopback | nothing: the kernel has nothing to say about the peer | the client is recorded as unestablished, and the channel is a declared weaker configuration |
| routable | the credential the class requires | the connection is refused with auth.required or auth.invalid |
- The established client is what
channel.attachedcarries, and the same valuechannel.detachednames later. - No operation carries a client identity, at any level.
- A managed interface attaches like any other client: established by the class of its channel's address and counted against the same cardinality. Being launched by the Core grants it nothing here.
The opening picture
A channel is given a snapshot when it attaches, before anything else.
| The opening picture carries | So that the client can |
|---|---|
| what this channel may address — the units, and the streams, commands and questions each exposes | render itself without a second call |
| the current state of each of those subjects | show the instrument as it is, not as it becomes |
| the channel's own state — attached, and whether it is suspended and in which grade | know whether what it shows is live and whether its controls act |
| the identity of the standing subscription, and the sequence the snapshot was taken at | narrow the filter, and join the stream of changes exactly |
| the contract version the Core speaks | fail early rather than at the first operation it cannot express |
The picture is the same record a read returns and a subscription opens with
(what a channel sees).
What ends an attachment
| Cause | What the Core does |
|---|---|
| the client closes | channel.detached, reason closed |
| the transport is lost | channel.detached, reason lost — at once when the connection ends without the client closing it, since the client can no longer be reached; and, while the connection still looks open, once liveness concludes it (below) |
| a managed interface's process ends | its connection closes with it; the channel is detached |
| the instance stops | channels stop accepting, and drain what they carry |
- Arbitration is recomputed on every one of them, so nothing stays suspended in favour of a channel
nobody holds. The detachment is announced first: a
channel.resumedit causes follows thechannel.detachedthat caused it. - Detaching leaves nothing behind. Subscriptions end with the connection, stream deliveries are released, and a client that returns attaches afresh and is given a new opening picture. Nothing about an attachment is persisted, and a Core that restarts ends every one it had.
A connection that looks open proves nothing
An unplugged cable or a suspended laptop can leave a socket that looks connected for a long time. So a client's liveness is its confirmed subscription (a subscription).
| Who must confirm | a client on a channel named in any arbitration rule — computed from the declaration, never declared beside it |
| What it acknowledges | a sequence: the last event it has processed |
| How often, and when it is stale | every 10 s; stale after 3 missed intervals |
| What being stale produces | channel.subscription.stale, an ordinary event about the channel, which arbitration reads |
| What it does not produce | buffering — a client that stopped confirming is not held for, and its return is a fresh snapshot |
Confirming is required, not offered. It bounds how long a client that is not showing reality can hold a machine's controls; it does not promise delivery.