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:
-
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:
-
methodsToCall
CallMethodRequest[]the call method request array
-
callback
Function-
err
Error | Null -
response
CallMethodResult[]
-
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 -
callback
Function
createMonitoredItems
-
options
-
callback
Parameters:
-
options
CreateMonitoredItemsRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
CreateMonitoredItemsResponse- the response
-
createSubscription
-
options
-
callback
Parameters:
-
options
CreateSubscriptionRequest-
requestedPublishingInterval
Duration -
requestedLifetimeCount
Counter -
requestedMaxKeepAliveCount
Counter -
maxNotificationsPerPublish
Counter -
publishingEnabled
Boolean -
priority
Byte
-
-
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
CreateSubscriptionResponse- the response
-
Example:
:
session.createSubscription(request,function(err,response) {} );
deleteMonitoredItems
-
options
-
callback
Parameters:
-
options
DeleteMonitoredItemsRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
deleteSubscriptions
-
options
-
callback
Parameters:
-
options
DeleteSubscriptionsRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
DeleteSubscriptionsResponse- the response
-
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
UInt32the subscription Id to return
-
callback
Function-
err
Error -
monitoredItems
the monitored Items
-
monitoredItems
the monitored Items
-
modifyMonitoredItems
-
options
-
callback
Parameters:
-
options
ModifyMonitoredItemsRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
ModifyMonitoredItemsResponse- the response
-
modifySubscription
-
options
-
callback
Parameters:
-
options
ModifySubscriptionRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
ModifySubscriptionResponse- the response
-
publish
-
options
-
callback
Parameters:
-
options
PublishRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
PublishResponse- the response
-
queryFirst
-
queryFirstRequest
-
callback
Parameters:
-
queryFirstRequest
QueryFirstRequest -
callback
Function-
err
Error | Null -
response
QueryFirstResponse
-
read
-
nodesToRead
-
[maxAge]
-
callback
Parameters:
-
nodesToRead
- an array of nodeId to read
-
nodeId
NodeId | String -
attributeId
AttributeId
-
[maxAge]
Number optional -
callback
Function- the callback function
-
err
Error | Null- the error or null if the transaction was OK
-
nodesToRead
ReadValueId[] -
results
DataValue[] -
diagnosticInfos
DiagnosticInfo[]
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:
-
nodes
NodeId[]- an array of nodeId to read
-
callback
Function- the callback function
-
err
Error | Null- the error or null if the transaction was OK
-
nodesToRead
ReadValueId[] -
results
DataValue[] -
diagnostic
DiagnosticInfo[]
Example:
:
session.readAllAttributes("ns=2;s=Furnace_1.Temperature",function(err,nodesToRead,dataValues,diagnostics) {} );
readHistoryValue
-
nodes
-
start
-
end
-
callback
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 | Nullthe 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
Parameters:
-
nodes
ReadValueId[]- the read value id
-
callback
Function- the callback function
-
err
Object | Nullthe 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
Parameters:
-
options
RepublishRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
RepublishResponse- the response
-
setPublishingMode
-
publishingEnabled
-
subscriptionIds
-
callback
Parameters:
-
publishingEnabled
Boolean -
subscriptionIds
Array -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
transferSubscriptions
-
options
-
callback
Parameters:
-
options
TransferSubscriptionsRequest -
callback
Function-
err
Error | Null- the Error if the async method has failed
-
response
TransferSubscriptionsResponse- the response
-
translateBrowsePath
-
browsePath
-
callback
Parameters:
-
browsePath
BrowsePath | Array -
callback
Function-
err
Error | Null -
response
BrowsePathResult | Array
-
write
-
nodesToWrite
-
callback
Parameters:
-
nodesToWrite
Array.- the array of value to write. One or more elements.
-
callback
Function- the callback function
-
err
Object | Nullthe 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
Parameters:
-
nodeId
NodeId- the node id of the node to write
-
value
Variant- the value to write
-
callback
Function-
err
Object | Nullthe error if write has failed or null if OK
-
statusCode
StatusCode- the status code of the write
-
diagnosticInfo
DiagnosticInfothe 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.