API Docs for: 0.0.57
Show:

ClientSession Class

Constructor

ClientSession

(
  • client
)

Parameters:

Methods

browse

(
  • nodes
  • callback
)
async

browse a node or an array of nodes.

Parameters:

  • nodes Object
  • callback Function
    • err Error | Null
    • results BrowseResult[]

      an array containing the BrowseResult of each BrowseDescription.

Example:

:

form1:

session.browse("RootFolder",function(err,results,diagnostics) {} );

form2:

var browseDescription = {
   nodeId: "ObjectsFolder",
   referenceTypeId: "Organizes",
   browseDirection: BrowseDirection.Inverse,
   includeSubtypes: true,
   nodeClassMask: 0,
   resultMask: 63
}
session.browse(browseDescription,function(err,results,diagnostics) {} );

form3:

session.browse([ "RootFolder", "ObjectsFolder"],function(err,results,diagnostics) {
   assert(results.length === 2);
});

form4:

 var browseDescription = [
   {
       nodeId: "ObjectsFolder",
       referenceTypeId: "Organizes",
       browseDirection: BrowseDirection.Inverse,
       includeSubtypes: true,
       nodeClassMask: 0,
       resultMask: 63
   }
 ]
 session.browse(browseDescription,function(err,results,diagnostics) {} );

call

(
  • methodsToCall
  • callback
)

Parameters:

Example:

: var methodsToCall = [ { objectId: "ns=2;i=12", methodId: "ns=2;i=13", inputArguments: [ new Variant({...}), new Variant({...}), ] }]; session.call(methodsToCall,function(err,response) { if (!err) { var rep = response[0]; console.log(" statusCode = ",rep.statusCode); console.log(" inputArgumentResults[0] = ",rep.inputArgumentResults[0].toString()); console.log(" inputArgumentResults[1] = ",rep.inputArgumentResults[1].toString()); console.log(" outputArgument[0] = ",rep.outputArgument[0].toString()); // array of variant } });

close

(
  • [deleteSubscription=true]
  • callback
)
async

Parameters:

  • [deleteSubscription=true] Boolean optional
  • callback Function

createMonitoredItems

(
  • options
  • callback
)
async

Parameters:

createSubscription

(
  • options
  • callback
)
async

Parameters:

  • options CreateSubscriptionRequest
    • requestedPublishingInterval Duration
    • requestedLifetimeCount Counter
    • requestedMaxKeepAliveCount Counter
    • maxNotificationsPerPublish Counter
    • publishingEnabled Boolean
    • priority Byte
  • callback Function

Example:

:

session.createSubscription(request,function(err,response) {} );

deleteMonitoredItems

(
  • options
  • callback
)
async

Parameters:

deleteSubscriptions

(
  • options
  • callback
)
async

Parameters:

Example:

:

session.deleteSubscriptions(request,function(err,response) {} );

getArgumentDefinition

(
  • methodId
  • callback
)

extract the argument definition of a method

Parameters:

  • methodId NodeId
  • callback Function
    • err Error | Null
    • inputArguments Argument<>
    • outputArguments Argument<>

getMonitoredItems

(
  • subscriptionId
  • callback
)

Parameters:

  • subscriptionId UInt32

    the subscription Id to return

  • callback Function
    • err Error
    • monitoredItems

      the monitored Items

    • monitoredItems

      the monitored Items

modifyMonitoredItems

(
  • options
  • callback
)
async

Parameters:

modifySubscription

(
  • options
  • callback
)
async

Parameters:

publish

(
  • options
  • callback
)
async

Parameters:

queryFirst

(
  • queryFirstRequest
  • callback
)

Parameters:

read

(
  • nodesToRead
  • [maxAge]
  • callback
)
async

Parameters:

  • nodesToRead
    • an array of nodeId to read
    • nodeId NodeId | String
    • attributeId AttributeId
  • [maxAge] Number optional
  • callback Function
    • the callback function

Example:

:

var nodesToRead = [
    {
         nodeId:      "ns=2;s=Furnace_1.Temperature",
         attributeId: AttributeIds.BrowseName
    }
];
session.read(nodesToRead,function(err,nodesToRead,results,diagnosticInfos) {
    if (!err) {
    }
});

readAllAttributes

(
  • nodes
  • callback
)
async

Parameters:

Example:

:

session.readAllAttributes("ns=2;s=Furnace_1.Temperature",function(err,nodesToRead,dataValues,diagnostics) {} );

readHistoryValue

(
  • nodes
  • start
  • end
  • callback
)
async

Parameters:

  • nodes ReadValueId[]
    • the read value id
  • start Object
    • the starttime in UTC format
  • end Object
    • the endtime in UTC format
  • callback Function
    • the callback function
    • err Object | Null

      the error if write has failed or null if OK

    • results DataValue[]
      • an array of dataValue each read
    • diagnosticInfos DiagnosticInfo[]
      • the diagnostic infos.

Example:

:

session.readHistoryValue("ns=5;s=Simulation Examples.Functions.Sine1","2015-06-10T09:00:00.000Z","2015-06-10T09:01:00.000Z",function(err,dataValues,diagnostics) {} );

readVariableValue

(
  • nodes
  • callback
)
async

Parameters:

  • nodes ReadValueId[]
    • the read value id
  • callback Function
    • the callback function
    • err Object | Null

      the error if write has failed or null if OK

    • results DataValue[]
      • an array of dataValue each read
    • diagnosticInfos DiagnosticInfo[]
      • the diagnostic info.

Example:

:

session.readVariableValue("ns=2;s=Furnace_1.Temperature",function(err,dataValues,diagnostics) {} );
  • read a single node :

    session.readVariableValue("ns=0;i=2257",function(err,dataValue) { if (!err) { console.log(dataValue.toString()); } });

  • read a array of nodes session.readVariableValue(["ns=0;i=2257","ns=0;i=2258"],function(err,dataValues) { if (!err) { console.log(dataValues[0].toString()); console.log(dataValues[1].toString()); } });

republish

(
  • options
  • callback
)
async

Parameters:

setPublishingMode

(
  • publishingEnabled
  • subscriptionIds
  • callback
)
async

Parameters:

  • publishingEnabled Boolean
  • subscriptionIds Array
  • callback Function
    • err Error | Null
      • the Error if the async method has failed

transferSubscriptions

(
  • options
  • callback
)
async

Parameters:

translateBrowsePath

(
  • browsePath
  • callback
)
async

Parameters:

write

(
  • nodesToWrite
  • callback
)
async

Parameters:

  • nodesToWrite Array.
    • the array of value to write. One or more elements.
  • callback Function
    • the callback function
    • err Object | Null

      the error if write has failed or null if OK

    • statusCodes StatusCode[]
      • an array of status code of each write
    • diagnosticInfos DiagnosticInfo[]
      • the diagnostic infos.

writeSingleNode

(
  • nodeId
  • value
  • callback
)
async

Parameters:

  • nodeId NodeId
    • the node id of the node to write
  • value Variant
    • the value to write
  • callback Function
    • err Object | Null

      the error if write has failed or null if OK

    • statusCode StatusCode
      • the status code of the write
    • diagnosticInfo DiagnosticInfo

      the diagnostic info.

Properties

endpoint

EndpointDescription

the endpoint on which this session is operating

Events

keepalive

keepalive_failure

raised when a keep-alive request has failed on the session, may be the session has timeout unexpectidaly on the server side, may be the connection is broken.

session_closed send when the session has been closed by the server ( proabably due to inactivity and timeout)