Browse
Browse(string nodeId, NodeClass filter = Unspecified) — Lists the direct child nodes (first level) of the specified node.
- For pagination of large nodes, please use BrowseWithPaging + BrowseNext.
- For path-based batch parsing, please use TranslateBrowsePaths.
Signature
public IReadOnlyList<OpcUaReference> Browse(
string nodeId,
NodeClass filter = NodeClass.Unspecified);
public IReadOnlyList<IReadOnlyList<OpcUaReference>> BrowseMany(
IReadOnlyList<string> nodeIds,
NodeClass filter = NodeClass.Unspecified);
OpcUaReference Field
| Field | Type | Note |
|---|---|---|
| NodeId | string | Child node NodeId |
| BrowseName | string | Browse NameUnqualified name, without a prefix ns (e.g. Temperature, not 2:Temperature) |
| DisplayName | string | Display Name Text |
| NodeClass | NodeClass | Child Node Categories |
⚠️ BrowseName This is a raw name, and OpcUaNode.BrowseName reads the BrowseName property, returning the ns:Name prefixed form. Names may conflict across namespaces; use NodeId for unique identifiers.
Examples
// List all child nodes Boiler1 under this node
var children = ua.Browse("ns=2;s=Boiler1");
foreach (var c in children)
Console.WriteLine($" {c.NodeClass} {c.BrowseName} -> {c.NodeId}");
// Show only Variable types
var vars = ua.Browse("ns=2;s=Boiler1", filter: NodeClass.Variable);
// View Only Method
var methods = ua.Browse("ns=2;s=Calculator", filter: NodeClass.Method);
Batch View (BrowseMany)
If you want to view multiple nodes at the same time (for example, when expanding the tree for the first GUI time), do it in one BrowseMany go RPC:
var roots = new[] { "i=85" /* Objects */, "i=86" /* Types */ };
var results = ua.BrowseMany(roots);
for (int i = 0; i < roots.Length; i++)
{
Console.WriteLine($"{roots[i]}:");
foreach (var c in results[i])
Console.WriteLine($" {c.BrowseName}");
}
If a node fails to load a page (NodeId error / server refusal), Only that slot If the list is empty, no exception is thrown; an exception is thrown only if the entire RPC batch fails OpcUaException.
NodeClass filter
filter Yes, a mask nodeClassMask (0 = no filtering), bitwise OR combinable:
| Value | Includes |
|---|---|
| Unspecified (0) | All |
| Object (1) | Object Only |
| Variable (2) | Variable Only |
| Method (4) | Method Only |
| Object | Variable | Both (bitwise OR) |
Exception
| Exception | When? |
|---|---|
| OpcUaException(BadNodeIdInvalid) | nodeId String cannot be parsed locally (e.g., incorrect ns=x syntax) |
| OpcUaException (Server Status Code) | Server Rejection (Common BadNodeIdUnknown / BadUserAccessDenied) |
| OpcUaException (Transmission Return Code) | Transport Layer Failure (Common BadCommunicationError) |
For session-level failures (BadSessionClosed etc.), automatically reconnect once and retry once; if it still fails, throw an exception; for node-level errors, throw an exception immediately.
Pagination for Large Nodes (ContinuationPoint)
The SDK fixes the "maximum number of references per node" in each Browse request at 1000. If the number of child nodes exceeds this limit, the server returns a single page plus a ContinuationPoint; in that case Browse returns only the first page.
Browse Once it's obtained, ContinuationPoint it's immediately discarded (neither returned to you nor notified to the server to be released), and the remaining child nodes cannot be retrieved; the continuation node status on the server side also remains uncleared. Nodes with many child nodesUse directly BrowseWithPaging.
To view the entire content, use BrowseWithPaging + BrowseNext:
var page = ua.BrowseWithPaging("ns=2;s=BigFolder");
var allRefs = new List<OpcUaReference>(page.References);
while (page.ContinuationPoint != null)
{
page = ua.BrowseNext(page.ContinuationPoint);
allRefs.AddRange(page.References);
}
Performance
Browse= Once RPC, send only one nodeBrowseMany= Send RPC N nodes at once; the number of network round trips is reduced from N to 1 (this saves on round trips, not server traversal time)- If there are more than 1000 child nodes, they will be paginated; you must use
BrowseNext(or use directlyBrowseAll)
BrowseFiltered — Direction + Reference Type Filter (Parameter exists, currently inactive)
BrowseFiltered This is an extension method of BrowseExtensions, with more Browse parameters than BrowseDirection + referenceTypeId + includeSubtypes + resultMask (Part 4 §5.8.2.2 BrowseDescription):
public static IReadOnlyList<OpcUaReference> BrowseFiltered(
this DarraOpcUa session,
string nid,
NodeClass nodeClassFilter = NodeClass.Unspecified,
BrowseDirection direction = BrowseDirection.Forward,
string referenceTypeId = null,
bool includeSubtypes = true,
uint resultMask = 0x3F);
Related Structures:
public enum BrowseDirection
{
Forward = 0, // Forward-only (outbound), parent→child
Inverse = 1, // Reverse only (inbound references), child → parent
Both = 2 // Returns results in both directions
}
Implementation Limitations (Read this section before proceeding)
BrowseFiltered Only input Browse with filtering enabled will actually be filtered by direction or reference type; Currently, this entry point does SDK not exist, so the fallback path is used in all cases. —— Equivalent to session.Browse(nid, nodeClassFilter):
| Parameters | Is this currently in effect? |
|---|---|
| nodeClassFilter | ✅ Enabled (passed to the server via nodeClassMask) |
| direction | ❌ Not effective; always positive |
| referenceTypeId | ❌ Does not take effect; Heng is always a reference type. |
| includeSubtypes | ❌ Not in effect |
| resultMask | ❌ Not effective; always applies to all fields |
In other words: "Tracing back to the parent node (who references me)" currently returns no results — Requests must be forward-directed, and OpcUaReference itself does not contain a field IsForward. Currently, all SDK entry points (Browse / BrowseAll / TranslateBrowsePaths / Resolve) follow only forward references; to find a parent node, one must traverse downward from a known parent node Browse. Degradation occurs only whenFor the first time When called, it triggers a Warning event (Events.Any / category Browse ) but does not throw an exception.
Example
// 1) Click "Filter NodeClass " — This setting actually works.
var vars = ua.BrowseFiltered("ns=2;s=Boiler1", nodeClassFilter: NodeClass.Variable);
// 2) The following three parameters are currently inactive and serve only as placeholders (see the table above); do not use them to evaluate results.
var same = ua.BrowseFiltered("ns=2;s=Boiler1",
direction: BrowseDirection.Both, // Currently, Hengzheng is moving upward
referenceTypeId: "i=33", // Currently Ignored
includeSubtypes: true); // Currently Ignored
If you really need direction / reference type filtering, etc., wait until an entry point with filtering is provided SDK before Browse using it direction / referenceTypeId.
BrowseAll — Auto-renew
BrowseExtensions Extension methods:
public static IReadOnlyList<OpcUaReference> BrowseAll(
this DarraOpcUa session, string nodeId,
NodeClass filter = NodeClass.Unspecified, int maxPages = 32);
Automatically loop repeatedly BrowseNext until it is empty ContinuationPoint; no need to write a manual loop on the business side.
var allRefs = ua.BrowseAll("ns=2;s=BigFolder");
Console.WriteLine($"共 {allRefs.Count} 个子节点");
maxPagesDefault 32: Stops after flipping through 32 pages; the remaining citationsDoes not return (If you need more, increase the size yourself or write the loopBrowseNextby hand.)- The cleanup phase will attempt to release server-side continuation points (if this fails, it will only be logged in the debug output and will not affect the results that have already been collected).
- If an RPC error occurs midway
OpcUaException, the request is discarded as usual; partial results are not returned.