NodeConfig class
Configuration for a NodeRuntime.
Constructors
-
NodeConfig({required Uri hubUri, required NodeId nodeId, Set<
String> capabilities = const {}, Map<String, String> labels = const {}, Map<String, String> metadata = const {}, Map<String, dynamic> attributes = const {}, String agentVersion = 'unknown', Map<String, dynamic> headers = const {}, Duration heartbeatInterval = const Duration(seconds: 10), Duration registerTimeout = const Duration(seconds: 10), ReconnectPolicy? reconnect, SecurityContext? securityContext, bool onBadCertificate(X509Certificate cert, String host, int port)?, NodeActionHandler? onRequest, Future<Map< registerPayload()?, Future<String, dynamic> >void> onRegistered(NodeRegistered ack)?, Future<void> onHandshake(HandshakeConnection connection)?, Future<Map< heartbeatPayload()?, Duration? pingInterval, Future<String, dynamic> >Connection> connect()?, bool isTerminal(Object error)?, Future<NodeDescriptor> descriptorBuilder()?}) - Creates a node configuration.
Properties
- agentVersion → String
-
The node agent version string.
final
-
attributes
→ Map<
String, dynamic> -
Structured, JSON-typed application data advertised alongside metadata
(see NodeDescriptor.attributes).
final
-
capabilities
→ Set<
String> -
Advertised capabilities.
final
-
connect
→ Future<
Connection> Function()? -
Opens the control connection, replacing the default
wss:///ws://dial to hubUri.final - descriptor → NodeDescriptor
-
The descriptor advertised at registration.
no setter
-
descriptorBuilder
→ Future<
NodeDescriptor> Function()? -
Builds the descriptor to advertise, replacing the static one assembled from
capabilities/labels/metadata/attributes.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, dynamic> -
Headers sent on the WebSocket upgrade (e.g.
Authorization).final - heartbeatInterval → Duration
-
Fallback heartbeat interval if the hub does not advertise one.
final
-
heartbeatPayload
→ Future<
Map< Function()?String, dynamic> > -
Builds the application data piggy-backed on every Heartbeat (e.g. a
resource-metrics snapshot), consumed hub-side by
NodeGateway.onHeartbeat.final - hubUri → Uri
-
The hub control endpoint (
ws:///wss://…/_node).final - isTerminal → bool Function(Object error)?
-
Whether the given
erroris unrecoverable, ending the runtime instead of retrying.final -
labels
→ Map<
String, String> -
Discovery labels.
final
-
metadata
→ Map<
String, String> -
Free-form metadata.
final
- nodeId → NodeId
-
This node's id.
final
- onBadCertificate → bool Function(X509Certificate cert, String host, int port)?
-
Escape hatch for accepting a self-signed certificate.
final
-
onHandshake
→ Future<
void> Function(HandshakeConnection connection)? -
Runs an in-band handshake over the freshly-opened control connection,
before the node registers — the node-side counterpart of the hub's
ConnectionAuthenticator(e.g. a challenge/response or signature exchange).final -
onRegistered
→ Future<
void> Function(NodeRegistered ack)? -
Called with the hub's NodeRegistered ack once registration succeeds —
the counterpart of registerPayload (e.g. to persist a signed
certificate). Runs on every (re)registration.
final
- onRequest → NodeActionHandler?
-
Handles NodeRequest RPCs from the hub, if the node serves any.
final
- pingInterval → Duration?
-
The WebSocket-level ping interval, for keepalive through idle-timing
proxies.
null(the default) disables it; the protocol's own Heartbeat is what the hub uses for liveness.final - reconnect → ReconnectPolicy
-
The reconnection backoff policy.
final
-
registerPayload
→ Future<
Map< Function()?String, dynamic> > -
Builds the application payload submitted with NodeRegister (e.g. a
certificate signing request), evaluated on every connection attempt so it
can be refreshed across reconnects.
final
- registerTimeout → Duration
-
How long to wait for a registration acknowledgement.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- securityContext → SecurityContext?
-
TLS trust for
wss://(e.g. a self-signed test cert).final
Methods
-
buildDescriptor(
) → Future< NodeDescriptor> - The descriptor for this connection attempt: descriptorBuilder's, or the static descriptor.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited