Address Space Browsing

Address space browsing is done with the ‘browse’ method. Both the client and server have this method.

The browse method accepts three parameter types:

  1. String with node ID
  2. Array of strings with Node ID
  3. Table with detailed parameters

These parameters are described in section browseParameters.

Method browse returns browseResult

Browsing by String NodeID

To browse a single node, you need to pass a string with node ID into the browse Method:

-- Browse one node by ID.
resp, err = client:browse(nodeIds.RootFolder)

Full source

To browse several nodes at once, you can pass an array of nodeIDs as follows:

-- Browse array of Node IDs.
resp, err = client:browse({nodeIds.RootFolder, nodeIds.TypesFolder})

Full source

Browsing a node by ID sends a request to the server with the following parameters:

  • Follow Hierarchical references in forward direction
  • Node class mask - All node classes
  • Result mask - all attributes

Detailed Parameters

For special cases, you can manually set the browse parameters as shown in the following example:

-- Full featured browsing
local browseParams = {
  requestedMaxReferencesPerNode = 0,
  nodesToBrowse = {
    {
      nodeId = nodeIds.RootFolder,
      referenceTypeId = nodeIds.HierarchicalReferences,
      browseDirection = ua.Types.BrowseDirection.Forward,
      nodeClassMask = ua.Types.NodeClass.Unspecified,
      resultMask = ua.Types.BrowseResultMask.All,
      includeSubtypes = 1,
    },
    {
      nodeId = nodeIds.RootFolder,
      referenceTypeId = nodeIds.HierarchicalReferences,
      browseDirection = ua.Types.BrowseDirection.Forward,
      nodeClassMask = ua.Types.NodeClass.Unspecified,
      resultMask = ua.Types.BrowseResultMask.All,
      includeSubtypes = 1,
    }
  },
}

local resp,err = client:browse(browseParams)

Full source