Skip to main content

BrowseWithPaging

browse Returns only the References list and discards the rest ContinuationPoint; suitable for scenarios involving "small, known nodes." For large nodes (with 100 or more child nodes), retrieve them explicitly browseWithPaging BrowsePage.

Prerequisite Reading
  • For continuing on the next page BrowseNext.
  • Get it right the first time. browseAll Inside, it's a loop browseWithPaging + browseNext.

Signature​

public BrowsePage browseWithPaging(String nodeId);
public BrowsePage browseWithPaging(String nodeId, Enums.NodeClass filter);

Usage​

BrowsePage page = ua.browseWithPaging("ns=2;s=BigFolder");
System.out.println("Got " + page.getReferences().size()
+ " children, more = " + page.hasMore());

if (page.hasMore()) {
BrowsePage next = ua.browseNext(page.getContinuationPoint(), false);
System.out.println("Next page: " + next.getReferences().size() + " more children");
}

When to Use browse vs browseWithPaging vs browseAll​

ScenarioAPI
Given that the number of child nodes is ≤ 50, pagination is not a concern.browse(...)
I'm not sure how many children there are, so just to be safe...browseWithPaging(...) + loop browseNext
Large nodes with 100+ child nodesbrowseAll(...) (Internal automatic pagination)
One Time, Multiple browse NodesbrowseMany(...) (Note: This does not browseMany return a value at this time.ContinuationPoint)

Complete Template​

The SDK already includes it — just use it as is:

public List<Reference> browseAll(String nodeId);
public List<Reference> browseAll(String nodeId, Enums.NodeClass filter, int maxPages);

Equivalent Notation (for reference and customization):

import com.darra.opcua.*;
import java.util.ArrayList;
import java.util.List;

public static List<Reference> browseAll(
OpcUaSession ua,
String nodeId,
Enums.NodeClass filter) {
List<Reference> all = new ArrayList<>();
BrowsePage page = ua.browseWithPaging(nodeId, filter);
all.addAll(page.getReferences());
while (page.hasMore()) {
page = ua.browseNext(page.getContinuationPoint(), false);
all.addAll(page.getReferences());
}
return all;
}

browseAll The default limit is 32 pages; if this limit is exceeded, the last page is automatically released to prevent memory leaks.

Next Step​