Skip to main content

BrowseWithPaging

browse Returns only the list Vec<Reference>; discard the rest ContinuationPoint. Suitable for scenarios with "small known nodes." For large nodes (100+ child nodes), explicitly browse_with_paging retrieve them BrowsePage.

Prerequisite Reading

Signature​

pub fn Session::browse_with_paging(
&self,
node_id: &str,
filter: NodeClass,
) -> Result<BrowsePage, OpcUaError>;

Usage​

use darra_opcua::NodeClass;

let page = s.browse_with_paging("ns=2;s=BigFolder", NodeClass::Unspecified)?;
println!("Got {} children, more = {}",
page.references.len(),
page.continuation_point.is_some());

if let Some(cp) = &page.continuation_point {
let next = s.browse_next(cp, false)?;
println!("Next page: {} more children", next.references.len());
}

When to Use browse vs browse_with_paging​

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...browse_with_paging(...) + loop browse_next
Large nodes with 100+ child nodesbrowse_with_paging(...) Required
Once Browse Multiple nodesbrowse_many(...) (Note: This does not return a value at this time. ContinuationPoint)
Automatically scroll through all pages in a single linebrowse_all(...)

Complete Template​

use darra_opcua::{Session, NodeClass, OpcUaError, Reference};

pub fn browse_all_paged(
s: &Session, node_id: &str, filter: NodeClass,
) -> Result<Vec<Reference>, OpcUaError> {
let mut page = s.browse_with_paging(node_id, filter)?;
let mut all = page.references;
while let Some(cp) = page.continuation_point.take() {
if cp.is_empty() { break; }
page = s.browse_next(&cp, false)?;
all.extend(page.references);
}
Ok(all)
}

Automatic Page Turning browse_all​

Note: The above is equivalent to the built-in SDK function Session::browse_all(...); we recommend using it directly:

pub fn browse_all(
&self, node_id: &str, filter: NodeClass, max_pages: usize,
) -> Result<Vec<Reference>, OpcUaError>;
let all = s.browse_all("ns=2;s=BigFolder", NodeClass::Unspecified, 100)?;

max_pages This is a safety limit designed to prevent an infinite loop CP caused by the server continuously returning errors; once the limit is reached, the current connection is automatically released CP.

Next Step​