cosmix-noded — the Bus broker
Every node in a cosmix mesh runs one cosmix-noded. It is the WebSocket
message broker that Bus citizens register with and address each other through —
the piece that makes send maild maild.stats on one process reach a cosmix-maild
on another.
What it is
A single binary running three async tasks:
- the broker — a WebSocket Bus router: services register a name, and it routes requests, replies, and topic pub/sub between them (local and cross-mesh).
- the system monitor — samples host CPU / memory / load and publishes it.
- the Bus traffic logger — taps every brokered message to an on-disk log.
It is the one daemon with no upstream dependency inside the mesh: a citizen needs a
broker before it can be addressed, so cosmix-noded starts first and everything
else orders After= it.
What it does
- Service registry. A citizen sends
noded.registeron connect to claim its service name; the name is released on disconnect ornoded.deregister. - Routing. Requests to
<service>route to the local holder; requests to<service>.<node>.busroute across the WireGuard mesh to that node's broker. - Topic pub/sub. Citizens
subscribeto topics; publishers fan out to every subscriber, with late-join replay where a topic supports it. - Admission control. Under
mesh.admission=enforce, a joining peer completes a challenge/response handshake (noded.admit.challenge/noded.admit.response) against the mesh authority before it can register. - Introspection.
noded.list,noded.peers, andnoded.inventoryreport who is registered, which mesh peers are reachable, and each citizen's build provenance (binary, version, git sha, pid, start time). - Self-observation. The monitor and logger each expose their own SPEC 12 property tree, so host metrics and log state are queryable as structured data.
Running it
/opt/cosmix/bin/cosmix-noded serve
Normally run under systemd as cosmix-noded.service, started before every other
cosmix daemon. Shared node config is read from /etc/cosmix/node.toml (the
[noded] block sets the listen address and admission mode); --listen, --node,
and --mesh-config override at the command line. The broker binds its WebSocket
listener to the node's WireGuard interface — clients with no node.toml fall back
to ws://127.0.0.1:4200/ws (loopback).
Interfaces
- Transport: WebSocket, path
/ws, default port4200on the node's mesh address. - Broker verbs:
noded.register,noded.deregister,noded.list,noded.peers,noded.inventory,noded.info,noded.ping,noded.tap(the logger's message feed), and the admission pairnoded.admit.challenge/noded.admit.response. - Monitor verbs:
mon.status,mon.processes, plus amon.props.*property surface (system.cpu_usage,system.mem_percent,system.load_avg_one, …). - Logger: taps
noded.tap, writesbus.log, exposes alog.props.*surface (runtime.events_seen,runtime.bytes_logged,lifecycle.tap_subscribed, …). - Broker properties:
noded.props.*with change events on thenoded.props.changedtopic.
Where it fits
- Links the Bus protocol family from the bus repo (
cosmix-lib-bus,cosmix-lib-client) and the substrate librariescosmix-lib-config,cosmix-lib-mesh,cosmix-lib-mesh-trust,cosmix-lib-props-store, andcosmix-lib-log. - Every other daemon —
cosmix-maild,cosmix-webd,cosmix-dnsd,cosmix-indexd— and every Mix--servecitizen is a client of it. - Cross-mesh routing rides the WireGuard peering that
cosmix-lib-meshdescribes.
Authenticated direct mesh callers (0.15.0)
For a direct ABP request, the source noded supplies mesh_from only for a
registered local citizen whose registry entry still belongs to that connection.
Client-supplied values are stripped. A mesh-to-mesh relay does not acquire this
assertion, so it cannot borrow an intermediary node's application grants.
At local service delivery, the receiving noded consumes that assertion and may
stamp broker_peer (the proven node) and broker_service (its source service).
This requires enforce admission, the correct successfully registered
bridge-<node> connection, verified current membership, active bus:true
status and current D2 credentials. from remains the registered bridge name;
broker_origin remains mesh. Applications must explicitly authorise the
stamped peer; admission alone does not grant clipboard or other capabilities.
Final validation and enqueue share a fence with inventory publication. Work already enqueued is not recalled. The existing admission policy grandfathers sessions while their member still has current D2 credentials; the new stamps do not introduce proving-key-specific revocation. Local clients, off/observe admission, unproven bridges, and unsolicited outbound-connection frames do not receive mesh identity stamps. Replies and topic payloads strip these reserved headers case-insensitively.
Replies are accepted only from the exact connection to which the pending request was delivered. A guessed correlation ID, reused service name or another connection cannot consume the legitimate request's reply slot.
See also
- maild — a broker client: the JMAP-native mail daemon
- libraries — the substrate crates the broker links
- overview — the cos daemon family
- bus messaging —
send/emit/on/reply, the primitives clients use to talk to the broker - serving as a citizen — writing a Mix service that registers with
cosmix-noded