Skip to main content

Nodes

s.nodes() It is a Lazy Load node accessor that allows you to access remote nodes just as you would local objects; at the same time, Session the previous set of methods browse_* directly uses strings NodeId.

Subpage Redirect
  • For the node container entry point, see NodeCollection.
  • For single-node wrapping, please refer to Node.
  • For single-level browsing, please see Browse.
  • To continue reading, please see the next page. BrowseNext.
  • For information on ContinuationPoint [...], please refer to BrowseWithPaging.
  • For batch parsing of paths, please refer to TranslateBrowsePaths.
  • For high-frequency access acceleration, please refer to RegisterNodes.

Four Ways to Access Nodes​

use darra_opcua::{NodeClass, well_known_nodes};

// Method 1: Direct String NodeId Access (Simplest and Most Efficient RPC)
let dv = s.read("ns=2;s=Temperature")?;

// Method 2: Lazy Load Node Wrapper (like local objects, exploratory)
let node = s.nodes().get("ns=2;s=Temperature");
let dv = node.value()?;
let time = s.nodes().server()
.child("ServerStatus").and_then(|n| n.child("CurrentTime"));

// Method 3: Path Resolution
if let Some(node) = s.resolve("/Objects/Server/ServerStatus/CurrentTime")? {
let dv = node.value()?;
}

// Method 4: Standard Node Constants
let dv = s.read(well_known_nodes::SERVER_SERVER_STATUS_CURRENT_TIME)?;

All four methods follow the same underlying process RPC; just choose the one that feels most natural to you.

Selection Guide​

ScenarioRecommendations
Known to be accurate NodeId (Production Code)Method 1: String
Standard ns=0 NodeMethod 4 + WellKnownNodes
Browse Tree / One-Time ScriptMethod 2: Chain Node
Batch Initialization of 100+ Pathstranslate_browse_paths
Long-term operation with high-frequency accessregister_nodes Accelerate

Node Is Clone​

Node is a lightweight value object; cloning is cheap and can be done freely:

let temp = s.nodes().get("ns=2;s=Temperature");
let temp_copy = temp.clone(); // Cheap clone
std::thread::spawn(move || {
let _ = temp_copy.value(); // Cross-thread reads
});

Next Step​