ClientSession Class
Constructor
Item Index
Methods
- browse
- call
- close
- createMonitoredItems
- createSubscription
- deleteMonitoredItems
- deleteSubscriptions
- getArgumentDefinition
- getMonitoredItems
- getPublishEngine
- modifyMonitoredItems
- modifySubscription
- publish
- queryFirst
- read
- readAllAttributes
- readHistoryValue
- readVariableValue
- republish
- setPublishingMode
- transferSubscriptions
- translateBrowsePath
- write
- writeSingleNode
Properties
Methods
browse
-
nodes -
callback
browse a node or an array of nodes.
Parameters:
-
nodesObject -
callbackFunction-
errError | Null -
resultsBrowseResult[]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:
-
methodsToCallCallMethodRequest[]the call method request array
-
callbackFunction-
errError | Null -
responseCallMethodResult[]
-
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
Parameters:
-
[deleteSubscription=true]Boolean optional -
callbackFunction
createMonitoredItems
-
options -
callback
Parameters:
-
optionsCreateMonitoredItemsRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
responseCreateMonitoredItemsResponse- the response
-
createSubscription
-
options -
callback
Parameters:
-
optionsCreateSubscriptionRequest-
requestedPublishingIntervalDuration -
requestedLifetimeCountCounter -
requestedMaxKeepAliveCountCounter -
maxNotificationsPerPublishCounter -
publishingEnabledBoolean -
priorityByte
-
-
callbackFunction-
errError | Null- the Error if the async method has failed
-
responseCreateSubscriptionResponse- the response
-
Example:
:
session.createSubscription(request,function(err,response) {} );
deleteMonitoredItems
-
options -
callback
Parameters:
-
optionsDeleteMonitoredItemsRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
deleteSubscriptions
-
options -
callback
Parameters:
-
optionsDeleteSubscriptionsRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
responseDeleteSubscriptionsResponse- the response
-
Example:
:
session.deleteSubscriptions(request,function(err,response) {} );
getArgumentDefinition
-
methodId -
callback
extract the argument definition of a method
Parameters:
-
methodIdNodeId -
callbackFunction-
errError | Null -
inputArgumentsArgument<> -
outputArgumentsArgument<>
-
getMonitoredItems
-
subscriptionId -
callback
Parameters:
-
subscriptionIdUInt32the subscription Id to return
-
callbackFunction-
errError -
monitoredItemsthe monitored Items
-
monitoredItemsthe monitored Items
-
modifyMonitoredItems
-
options -
callback
Parameters:
-
optionsModifyMonitoredItemsRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
responseModifyMonitoredItemsResponse- the response
-
modifySubscription
-
options -
callback
Parameters:
-
optionsModifySubscriptionRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
responseModifySubscriptionResponse- the response
-
publish
-
options -
callback
Parameters:
-
optionsPublishRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
responsePublishResponse- the response
-
queryFirst
-
queryFirstRequest -
callback
Parameters:
-
queryFirstRequestQueryFirstRequest -
callbackFunction-
errError | Null -
responseQueryFirstResponse
-
read
-
nodesToRead -
[maxAge] -
callback
Parameters:
-
nodesToRead- an array of nodeId to read
-
nodeIdNodeId | String -
attributeIdAttributeId
-
[maxAge]Number optional -
callbackFunction- the callback function
-
errError | Null- the error or null if the transaction was OK
-
nodesToReadReadValueId[] -
resultsDataValue[] -
diagnosticInfosDiagnosticInfo[]
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
Parameters:
-
nodesNodeId[]- an array of nodeId to read
-
callbackFunction- the callback function
-
errError | Null- the error or null if the transaction was OK
-
nodesToReadReadValueId[] -
resultsDataValue[] -
diagnosticDiagnosticInfo[]
Example:
:
session.readAllAttributes("ns=2;s=Furnace_1.Temperature",function(err,nodesToRead,dataValues,diagnostics) {} );
readHistoryValue
-
nodes -
start -
end -
callback
Parameters:
-
nodesReadValueId[]- the read value id
-
startObject- the starttime in UTC format
-
endObject- the endtime in UTC format
-
callbackFunction- the callback function
-
errObject | Nullthe error if write has failed or null if OK
-
resultsDataValue[]- an array of dataValue each read
-
diagnosticInfosDiagnosticInfo[]- 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
Parameters:
-
nodesReadValueId[]- the read value id
-
callbackFunction- the callback function
-
errObject | Nullthe error if write has failed or null if OK
-
resultsDataValue[]- an array of dataValue each read
-
diagnosticInfosDiagnosticInfo[]- 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
Parameters:
-
optionsRepublishRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
responseRepublishResponse- the response
-
setPublishingMode
-
publishingEnabled -
subscriptionIds -
callback
Parameters:
-
publishingEnabledBoolean -
subscriptionIdsArray -
callbackFunction-
errError | Null- the Error if the async method has failed
-
transferSubscriptions
-
options -
callback
Parameters:
-
optionsTransferSubscriptionsRequest -
callbackFunction-
errError | Null- the Error if the async method has failed
-
responseTransferSubscriptionsResponse- the response
-
translateBrowsePath
-
browsePath -
callback
Parameters:
-
browsePathBrowsePath | Array -
callbackFunction-
errError | Null -
responseBrowsePathResult | Array
-
write
-
nodesToWrite -
callback
Parameters:
-
nodesToWriteArray.- the array of value to write. One or more elements.
-
callbackFunction- the callback function
-
errObject | Nullthe error if write has failed or null if OK
-
statusCodesStatusCode[]- an array of status code of each write
-
diagnosticInfosDiagnosticInfo[]- the diagnostic infos.
writeSingleNode
-
nodeId -
value -
callback
Parameters:
-
nodeIdNodeId- the node id of the node to write
-
valueVariant- the value to write
-
callbackFunction-
errObject | Nullthe error if write has failed or null if OK
-
statusCodeStatusCode- the status code of the write
-
diagnosticInfoDiagnosticInfothe diagnostic info.
-
Properties
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.
The NodeOPCUA API