Skip to main content

BrowseNext

When the number of child nodes exceeds the server's single-page limit, the server will return a non-empty continuation_point (paging token) in the BrowseResult. Pass it BrowseWithPaging on to you as-is, and use it to BrowseNext retrieve the next page. (Browse The token will CP be discarded once retrieved, so pagination must always start BrowseWithPaging from the BrowseResult.)

Prerequisite Reading

Signature​

BrowseNext Session It is a member method.

namespace darra::opcua {

class Session {
public:
BrowsePage BrowseNext(
std::vector<uint8_t> const& continuation_point,
bool release = false);
};

}
ParametersNote
continuation_pointLast Browse/ BrowseNext returned continuation token
releasetrue = Abort further paging; the server releases resources (no references are returned)

BrowsePage Structure​

struct BrowsePage {
std::vector<Reference> references;
std::vector<uint8_t> continuation_point; // Empty = No more pages
};

Complete Page-Turning Example​

#include <darra/opcua/client.hpp>
#include <iostream>

using namespace darra::opcua;

Session s("opc.tcp://localhost:4840");
s.Connect();

auto page = s.BrowseWithPaging("ns=2;s=BigFolder");
std::vector<Reference> all_refs = page.references;

while (!page.continuation_point.empty()) {
page = s.BrowseNext(page.continuation_point);
all_refs.insert(all_refs.end(), page.references.begin(), page.references.end());
}

std::cout << "Total " << all_refs.size() << " children\n";

Proactive Release (Saves Server Resources)​

The server maintains ContinuationPoint a state for each one, which consumes resources. If you decide to stop browsing partway through, call the method to explicitly release=true release it:

s.BrowseNext(page.continuation_point, /*release=*/true);

release=true In this case, the server only releases the state and does not return the next page; it may BrowseResult be NULL—meaning the return value BrowsePage.references is empty. If the state is not explicitly released, it will be reclaimed by the server's own timeout mechanism; the specific duration is determined by the server's implementation and is SDK not controlled.

Note​

  • continuation_point is an opaque byte array, Do not modify / parse
  • The server uses this byte string to determine the browsing state when resuming the browse; do not assume that reusing the same one continuation_point will take you back to a specific page.
  • The number of connections a server can maintain simultaneously depends ContinuationPoint on the server's implementation; there are SDK no limits, and connections are not cached. When a connection is finished or abandoned, let it naturally CP become empty or explicitly release it.

Next Step​