v1.2.0
Control-plane release — the node protocol grows the pieces an application needs to run a real HUB/Node infrastructure on it (enrolment, node-initiated calls, domain-specific discovery), instead of only the "worker node" shape where the hub calls the node and the node merely heartbeats.
Fully backward-compatible (additive): every new wire field is omitted when empty and every new hook defaults to null, so existing peers and callers are unaffected.
Added
- Bidirectional RPC.
request/responsenow flow in both directions. A node calls the hub withNodeRuntime.request(action, payload:), answered by the hub's newNodeGateway.onRequest— which receives the callingRegisteredNode, so the hub knows who is asking and can authorize on itsprincipal. Registration is a precondition: a request from a connection that has not registered is rejected ("Not registered") without reaching the handler. The hub→node direction (NodeGateway.request) is unchanged. Previously the only node-initiated message wasquery, so an application needed a second channel back to the hub. - Enrolment.
NodeRegisterandNodeRegisteredcarry aMap<String, dynamic> payload, andNodeGateway.onRegistervets registrations — returning the ack payload, or throwing aHubExceptionto reject (the hub replieserror, closes, and never registers the node). Node-side:NodeConfig.registerPayload/NodeConfig.onRegisteredandNodeRuntime.registration. This is the seam for CA-style enrolment: submit a CSR, get a signed certificate back. - Node-side in-band handshake.
NodeConfig.onHandshakeruns on the raw connection before registering — the counterpart of the hub's existingConnectionAuthenticator, which had no node-side half — so a node can now answer a challenge/response or key-agreement exchange. Unconsumed frames are replayed to the control protocol. - Application-defined discovery.
NodeDescriptor.attributes(Map<String, dynamic>, may nest — unlike the flat string-onlylabelsandmetadata),NodeQuery.filter, and theNodeMatcherport, so an application owns query semantics the hub cannot know about (version ranges, nested service catalogues).NodeRegistry.discovertakes awherepredicate. NodeUpdate(t: "update") — a node revises its advertised descriptor without re-registering.Json.optObjectfor reading free-form JSON object fields.
Changed
NodeGateway.codecandNodeRuntime.codecare now typedConnectionCodec<NodeControlMessage>rather than the concreteMessageCodec, so an application can supply its own wire format (e.g. binary) without forking either endpoint.MessageCodec.standard()remains the default; source-compatible for existing callers.
Fixed
- In-flight RPCs no longer hang when a connection drops.
NodeGatewayandNodeRuntimenow fail their pending calls withNodeUnavailableExceptionon disconnect, goodbye and heartbeat timeout, instead of leaving callers to wait out their own timeout.NodeRuntime's pending discovery queries were leaked on disconnect and are now cleared too.
Full Changelog: v1.1.0...v1.2.0