Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
shivam mishra

Hello every one, i need help regarding bellow issue i am facing from quite few days .


- Connection break after subscribing to an Event [ server desabled the port ]


- Program is monitoring variabled without any issue, but when i try monitoring Alarm, 
Program says connection break, and OPCUA close the communication PORT, and then i have to restart the OPCUA server  manually to get working again.

node - 8.11.4
npm - 5.6.0
node-opcua - 0.4.5


subscription = new opcua.ClientSubscription(this.session, {
        requestedPublishingInterval: 100,
        requestedLifetimeCount: 1000,
        requestedMaxKeepAliveCount: 12,
        maxNotificationsPerPublish: 10,
        publishingEnabled: true,
        priority: 10

let monitorAlarm = this.subscription.monitor({
        nodeId: "ns=2;s=Sinumerik",
        attributeId: opcua.AttributeIds.EventNotifier,
        indexRange: null,
        dataEncoding: null//{ namespaceIndex: 0, name: null }
    }, {
            queueSize: 100000,
            filter: opcua.constructEventFilter([
            ], [opcua.resolveNodeId("ConditionType")]),
            discardOldest: true

Steps I followed

** With variables **
- created client -> success
- created session -> success
- created subscription -> success
- subscription to monitor variables -> success

** With Alarm **

- created client -> success
- created session -> success
- created subscription -> success
- subscription to monitor Alarms  -> [ Connection break ]  [  server disable the communication port ]
Philip Ackermann
Hello everybody,
short question: is there a way to delete nodes from an OPC UA tree at runtime?
Philip, please be more specific : do you mean a server deleting it's own node at runtime , or a client requesting a server to do so ?
Philip Ackermann
It would be the server deleting it's own node.
Try addressSpace.deleteNode(nodeId);
Philip Ackermann
Ah, ok. Thanks! I did not found this or a similar method in the documentation (http://node-opcua.github.io/api_doc/0.4.5/classes/AddressSpace.html), but just found it at the documentation for Version 0.2.0. Does this mean that the documentation from Version 0.4.5 "extends" the version from 0.2.0?

Error: disconnect shall not be called while the 'one time message receiver' is in operation
at assert (/app/node_modules/node-opcua-assert/dist/index.js:6:21)
at ServerTCP_transport.TCP_transport.disconnect (/app/node_modules/node-opcua-transport/src/tcp_transport.js:406:5)
at ServerSecureChannelLayer.close (/app/node_modules/node-opcua-secure-channel/src/server/server_secure_channel_layer.js:924:20)
at _prevent_DOS_Attack (/app/node_modules/node-opcua-server/src/server_end_point.js:219:17)
at OPCUAServerEndPoint._on_client_connection (/app/node_modules/node-opcua-server/src/server_end_point.js:252:5)
at emitOne (events.js:121:20)
at Server.emit (events.js:211:7)
at TCP.onconnection (net.js:1565:8)
Does anyone know what does that error mean?
I'm reading different nodes every minute and sometimes I get that error and my node-opc-ua server crash
Philip Ackermann
@erossignon And another question: maybe I'm doing something wrong here, but when I add a variable as a component of a parent node using the addVariable() method, internally (on the JavaScript object that represents the parent node) a property with the name of the variable is created. However this means that for example you cannot create variables that have a name of an already existing property of that object (of type UAObject), e.g., displayName, description, tests. Is this intended or am I doing something wrong?
The screenshot probably better describes the problem: exampleProperty1 and exampleProperty2 were created using addVariable() and are on the same level as other pre-defined properties like displayName.
Yes you are right. There could be name collision here .. although in practice this will be rare
It's quite handy to be able to access the internal server tree using a chain of javascript objects such as rootFolder.objects.devices.myDevice.myComponent.myVariable rather than addressSpace.findNode("RootFolder").getChildByName("Objects").getChildByName("Devices").getComponent("MyComponent").....
Philip Ackermann
Ok, but wouldn't it be better to then have all the other default properties of the JavaScript object starting with an underscore, e.g., _description, _tests?
And yet another thing: I noticed that the first letter of the automatically get converted to lower case, e.g., ExampleProperty1 gets converted to exampleProperty1. Wouldn't it be more consistent to not automatically convert this?
And btw. (I'm not sure if I remember correctly) I think there were even cases when the first two letters got converted to lower case.
Philip Ackermann
@erossignon Great library by the way! I'm just putting ideas on the table here :-)
Hello ,
I would like to create a secure communication in OPC-UA between the server (node-opcua) and the client (UaExpert). The OPC-UA server has been created in a Raspberry Pi. In the server I used node-opcua-server certificates.
But, I want the client, to be able to communicate with the server, have to use the certificate mandatorily. In UaExpert, when I pulse Discovery and I add the direction of my OPC-UA server, it appears that I can access my OPC-UA server with many types of security:
None - None (uatcp-uasc-uabinary)
Basic256Sha256 - Sign & Encrypt (uatcp-uasc-uabinary)
In the secure configuration Basic256Sha256 - Sign & Encrypt, I have to trust the client certificate in the server. And I like it. But then, in UaExpert if I try to connect using None - None configuration, I can access to the server freely.
I would like to configure a secure configuration in the server, and when I Discovery the server in UaExpert, I want that I can only communicate using Basic256Sha256 - Sign & Encrypt. How can I do?
Askhat Konyrbayev

Hello everyone!
I am monitroing multiple items group in 1 minute interval. it should be working 24/7, but after awhile I get this error:

Timeout .... waiting for response for OpenSecureChannelRequest { /RequestHeader/
authenticationToken / NodeId /: ns=0;i=0
timeStamp / UtcTime /: 2018-11-20T00:58:14.258Z
requestHandle / IntegerId /: 12456 0x30a8
returnDiagnostics / UInt32 /: 0 0x0
auditEntryId / UAString /: null
timeoutHint / UInt32 /: 0 0x0
additionalHeader / ExtensionObject /: null

followed by this:

Timeout .... waiting for response for PublishRequest { /RequestHeader/
authenticationToken / NodeId /: ns=0;i=2284256694
timeStamp / UtcTime /: 2018-11-20T00:55:42.605Z
requestHandle / IntegerId /: 12451 0x30a3
returnDiagnostics / UInt32 /: 0 0x0
auditEntryId / UAString /:
timeoutHint / UInt32 /: 300000 0x493e0
additionalHeader / ExtensionObject /: null

then, I believe, it reconnects, but unfortunately it stops updating values.
I have to disconnect from server and reconnect to it to make it work again.
What might be causing this error? Is it possible to re-establish connection with values updating again?

Philip Ackermann

Short question: does anybody know how to update the browse name of a node at runtime? Without writing the value by a client, but changing it from within the server.

I tried different things, including the following snippet, but it is not reflected in the tree on the client-side.

const oldName = node.browseName;
const newName = new opcua.QualifiedName({
  name: 'example',
  namespaceIndex: oldName.namespaceIndex
node.browseName = newName;

Is there maybe a method to update the state of the tree after modifying it?

@cleancoderocker I don't think is is allowed to change the browse name of a node at runtime in the server, BrowseName shall be normative and stable. Most client will assume that browseName, once read, do not change anyway.
I have two questions. If I want to create a OPC UA server, I can define all those folders and tags by making a declaration of addObject or addVariable.
I can also use opcua.standard_nodeset_file to create those folders and tags by xml file. For making a declaration to create tags, I can add get and set function to change variable. Question 1: For xml method, how do I change the tag value? Question 2: Is there an easy way to create folders and tags by JSON format file? (I mean that read the key value structure from JSON file, and make a run-time declaration to create folders and tags by the key value pair. Also declare the get set function. Then we can start the OPC UA Server)
Marco Salafia
Is Local Discovery Server with Multicast Extension implemented? #578 I really appreciate more information or examples about this (if it is implemented) because i need this feature for my reasearch and i really would like to use node-opc-ua.
Dear OPC UA experts. I've tried to implement the OPC UA client and read and write to one Real and one Bool variable. I have matrikon test server running. Can you post please one js file example where I can read and write to one REAL variable, no subscriptions needed. BY example I mean complete code as I struggle to get stuff working. Many thanks!

Good day to ya'll. I am currently trying to install an OPC interface for a Smalltalk based application, for convenience I chose node-opcua and mostly its golden.
However I'm having problems with the nodecrawler, namely I can't seem to find any self-added variables/device objects (I do find everything else though).


heres my call (sorry, missclicked the first time >.<)
const NodeCrawler = require("node-opcua-client-crawler").NodeCrawler;
const opcua = require("node-opcua");
const ObjectIds = require("node-opcua-constants").ObjectIds;
const makeNodeId = require("node-opcua-nodeid").makeNodeId;

function execute() {
    var session = opcSession.value();  //these are input pins
    const crawler  = new NodeCrawler(session);
    const array = [];
    var maxLevels = depthOfCrawl.value();

    const data = {
            __level__: 1,
            onBrowse: function( crawler,cacheNode) {
                let savedLevel = this.__level__;
                if (savedLevel < maxLevels) {
                    this.__level__ = this.__level__ + 1;
                    this.__level__ = savedLevel;

const nodeId = makeNodeId(ObjectIds.Server_ServerCapabilities);
    console.log("makeNodeId: "+ nodeId);
    crawler.crawl(nodeId,data, function(err){
            if(!err) {                
Im inclined to believe I've made a really stupid mistake which would take seconds to fix but I can't for the life of me find it.
Hi All,
  1. I am from a different story, but my concern is if you are using any OPC UA Information Model compiler to generated Address Space and custom classes in your approach if applicable?
  2. Have you implemented PubSub or are you going to implement Part 14?
    Thanks, Mariusz
Juan Camargo
Hi Everyone, I'm trying to create a method that unregisters the server from the LDS, any ideas on how to accomplish this?
Hans Fleischmann

i try to set up node-opc ua and a corresponding logger (https://github.com/coussej/node-opcua-logger, https://github.com/coussej/node-opcua-logger/issues/16) correctly, here is my configuration. I have also tried this:

url             = "opc.tcp://"
failoverTimeout = 5000 # time to wait before reconnection in case of failure

name             = "influx_1"
type             = "influxdb"
host             = ""
port             = 8086
protocol         = "http"
username         = ""
password         = ""
database         = "rh_linie_test"
failoverTimeout  = 10000
bufferMaxSize    = 64
writeInterval    = 3000
writeMaxPoints   = 1000

# A polled node:
#name               = "Int16polled"
#tags               = { tag1 = "test", tag2 = "AB43" }
#tags               = { tag1 = "testtag" }
#nodeId             = "ns=4;s=RH Montage 2. Config.RH Master.GlobalVars.00DB ZEITEN_ZAEHLER.SPS_ZYKLUS_AKT"
#collectionType     = "polled"
#pollRate           = 60     # samples / minute.
#deadbandAbsolute   = 0      # Absolute max difference for a value not to be collected
#deadbandRelative   = 0.0    # Relative max difference for a value not to be collected

# A monitored node
name               = "Int32monitored"
dataType           = "number"
tags               = { tag1 = "test", tag2 = "AB43" }
nodeId             = "ns=4;s=RH Montage 2. Config.RH Master.GlobalVars.00DB ZEITEN_ZAEHLER.SPS_ZYKLUS_AKT"
collectionType     = "monitored"
monitorResolution  = 1000    # ms
deadbandAbsolute   = 0         # Absolute max difference for a value not to be collected
deadbandRelative   = 0        # Relative max difference for a value not to be collected

and i get:

azuredev@x01133175:~/node-logger/node-opcua-logger$ node logger.js
influx_1 : starting writepump [ writeLimit:  1000 , writeInterval: 3000 ].
[ 'opc.tcp://m01009186:48010 NONE http://opcfoundation.org/UA/SecurityPolicy#None',
  'opc.tcp://m01009186:48010 SIGN http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15',
  'opc.tcp://m01009186:48010 SIGNANDENCRYPT http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15',
  'opc.tcp://m01009186:48010 SIGN http://opcfoundation.org/UA/SecurityPolicy#Basic256',
  'opc.tcp://m01009186:48010 SIGNANDENCRYPT http://opcfoundation.org/UA/SecurityPolicy#Basic256',
  'opc.tcp://m01009186:48010 SIGN http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256',
  'opc.tcp://m01009186:48010 SIGNANDENCRYPT http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256' ]
An error occured in the Readpump: Error:  End point must exist opc.tcp://
    at OPCUAClient._createSession (/home/azuredev/node-logger/node-opcua-logger/node_modules/node-opcua-client/src/opcua_client.js:163:25)
    at OPCUAClient.createSession (/home/azuredev/node-logger/node-opcua-logger/node_modules/node-opcua-client/src/opcua_client.js:623:10)
    at OPCUAClient.eval [as createSession] (eval at thenify.withCallback (/home/azuredev/node-logger/node-opcua-logger/node_modules/thenify/index.js:33:10), <anonymous>:6:48)
    at /home/azuredev/node-logger/node-opcua-logger/readpump.js:25:23
    at Timeout.delayer [as _onTimeout] (/home/azuredev/node-logger/node-opcua-logger/node_modules/delayed/delayed.js:27:10)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
Restarting readpump in 5000 seconds.
@Hans85 please try url = "opc.tcp://m01009186:48010" and let me know
@Camarbro please try server.registerServerManager.stop((err){ });
Alex Barnhill

Has anyone had issues installing the package behind a proxy? Everything will be installed properly, however upon attempting to install the certificates 2 weird things happen:

  1. The local version of openssl installed is not recognized at all so the package tries to fetch its own version from github
  2. The version from github can't be downloaded due to a timeout and the certificates are not installed, rendering the package non-functional.

When I've tried this on a network outside of my proxy it works without issue. I'm not really sure what to make of this at the moment. I can download the version from github myself and place it into the AppData folder, however this is a very messy way of going about it


@alexbarnhill I guess you're working on windows. you'll have to install the openssl package manually.

  • alternatively you could contact your network admin to allow download access from https://github.com/ in the proxy setting
@erossignon my concern is if you are using any tool to generate the Address Space content description ? Are you using UANodeSet to populate the AS?
@mpostol we are capable of loading standard nodeset2.xml files to generate the address space. This is the recommanded approach to load all the dataType/ObjectType/eventType etc of a new namespace.... Live objects in the /root/objects folder are usually created dynamically at runtime ( although we could also use a nodeset2.xml).
Node-opcua has a nice feature that allows new objects instances to be easily instantiate from their type...
@mpostol we can also generate new namespace containing DataType/ObjectType/VariableType etc programmatically and export them to NodeSet2.XML file.
@erossignon thanks, I am sure the server is capable to instantiate the address space and export it current content to UANodeSet xml file. My concern is if you are working on any design tools targeting the AS off line modeling. I am asking because I have decide to publish the Address Space Model Designer (developed by CAS) tool and first I must work out a road map, you know projects, tasks, priorities. Because offline design process is independent it could be reuse in different technologies. It seems it is longer discussion so let's move it to conf call. Anyway, in-band-interoperability is defined by the spec, but out-of-band is not, co my question.
Alex Barnhill
@erossignon Thanks for the feedback. Unfortunately I need it installed behind networks that I don't have any control over, and the copying makes it a bit difficult for automatic installs. I understand the limitations though. Thanks again!
I'm looking for some latest information about how to use custom structured data types (extension objects) in server / client side with node-opcua. I have done some work in older version of node-opcua to get it working as workaround (see https://github.com/node-opcua/node-opcua/issues/320#issuecomment-382690353), but perhaps there is now some better way in recent versions? I noticed there is some concept of "dynamic extension object" in some commit messages.
@erossignon any updates about this progress?

Hi there, is there a built-in-way on the library to support a reverse connection from the server to the client to start the communication. i can see this piece of code, but i cant find anything else...

"RCP", // Supports the reverse connect capabilities defined in Part 6.
"PUB", // Supports the Publisher capabilities defined in Part 14.
"SUB", // Supports the Publisher capabilities defined in Part 14.

Thanks in advance.

Juan Camargo
@erossignon Thanks for the tip!
Hiii, some body know how i can write Uint16Array in kepserver i got some error: ConstantStatusCode {
_value: 2147483648,
_description: 'The value is bad but no specific reason is known.',
_name: 'Bad' } ]
i'm try this

var valor = new Uint16Array([ 2, 23, 23, 12, 24, 3, 25, 3, 26, 3, 27, 3, 28, 1, 43690, 1, 1261, 0, 0, 0, 0, 0, 0, 0, 65535, 11 ])

nodeToWrite[0] = {
nodeId: resolveNodeId("ns=2;s=" + endereco[0].ADDRESS),
attributeId: opcua.AttributeIds.Value,

value: /new DataValue(/{ value: {/ Variant /
dataType: 5,
arrayType: 1,
value: valor,