Skip to content

Instantly share code, notes, and snippets.

@erossignon
Created December 16, 2018 15:29
Show Gist options
  • Save erossignon/89de0a97fbb55b3e2135197eb07a4765 to your computer and use it in GitHub Desktop.
Save erossignon/89de0a97fbb55b3e2135197eb07a4765 to your computer and use it in GitHub Desktop.
server with 20k variables
/* global console, require */
const opcua = require("node-opcua");
const server = new opcua.OPCUAServer({
port: 26543 // the port of the listening socket of the server
});
function post_initialize() {
const addressSpace = server.engine.addressSpace;
const namespace = addressSpace.getOwnNamespace();
//xx addressSpace.isFrugal = true;
const myDevice = namespace.addObject({
organizedBy: addressSpace.rootFolder.objects,
browseName: "MyDevice"
});
const nbVariables = 20000;
const t1 = Date.now();
for(let i=0;i< nbVariables ; i++) {
namespace.addVariable({
browseName: "Var"+ i,
dataType: "Double",
propertyOf: myDevice
});
}
const t2 = Date.now();
console.log(" variables added ! ",t2-t1);
}
server.initialize(post_initialize);
server.start(function () {
console.log("Server is now listening ... ( press CTRL+C to stop)");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment