Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main() {
try {
const server = new OPCUAServer({
registerServerMethod: RegisterServerMethod.LDS
});
await server.initialize();
server.on("request", (request: Request) => {
console.log(request.constructor.name, request.requestHeader.requestHandle);
// you can either check the instance of the request object directl
if (request instanceof BrowseRequest) {
console.log("BrowseRequest.requestedMaxReferencesPerNode=", request.requestedMaxReferencesPerNode);
} else if (request instanceof ActivateSessionRequest) {
console.log(request.toString());
}
async function main() {
try {
const server = new OPCUAServer({
nodeset_filename: [
nodesets.standard_nodeset_file
]
});
await server.initialize();
// post-initialize
const addressSpace = server.engine.addressSpace!;
const object = installObjectWithMethod(addressSpace);
console.log("object = ", object.toString());
await callMethodFromServer(addressSpace, object.nodeId);
await server.start();
async function main() {
const server = new OPCUAServer(server_options);
console.log(chalk.yellow(" server PID :"), process.pid);
server.on("post_initialize", () => {
const addressSpace = server.engine.addressSpace!;
// to do: expose new nodeid here
const ns = addressSpace.getNamespaceIndex("http://yourorganisation.org/my_data_type/");
const myStructureType = addressSpace.findVariableType("MyStructureType", ns);
if (!myStructureType) {
console.log(" ns = ", ns, "cannot find MyStructureDataType ");
return;
}
const namespace = addressSpace.getOwnNamespace();
(async () => {
try {
const server = new opcua.OPCUAServer({
port: 4334, // the port of the listening socket of the servery
buildInfo: {
productName: "WeatherStation",
buildNumber: "7658",
buildDate: new Date(2019,6,14),
}
});
await server.initialize();
construct_my_address_space(server);
await server.start();
console.log("Server is now listening ... ( press CTRL+C to stop)");
/*global require,setInterval,console */
const opcua = require("node-opcua");
// Let's create an instance of OPCUAServer
const server = new opcua.OPCUAServer({
port: 4334, // the port of the listening socket of the server
resourcePath: "/UA/MyLittleServer", // this path will be added to the endpoint resource name
buildInfo : {
productName: "MySampleServer1",
buildNumber: "7658",
buildDate: new Date(2014,5,2)
}
});
function post_initialize() {
console.log("initialized");
function construct_my_address_space(server) {
const addressSpace = server.engine.addressSpace;
const namespace = addressSpace.getOwnNamespace();
(async () => {
try {
const server = new opcua.OPCUAServer({
port: 4334 // the port of the listening socket of the server
});
await server.initialize();
const addressSpace = server.engine.addressSpace;
const namespace = addressSpace.getOwnNamespace();
const myDevice = namespace.addObject({
organizedBy: addressSpace.rootFolder.objects,
browseName: "MyDevice"
});
const method = namespace.addMethod(myDevice,{
/* global console, require */
var opcua = require("node-opcua");
const server = new opcua.OPCUAServer({
port: 4334 // the port of the listening socket of the server
});
function post_initialize() {
const addressSpace = server.engine.addressSpace;
const namespace = addressSpace.getOwnNamespace();
const myDevice = namespace.addObject({
organizedBy: addressSpace.rootFolder.objects,
browseName: "MyDevice"
});
const fakeValue = 1;
async function main() {
process.title = "Node OPCUA Server on port : " + server_options.port;
const server = new OPCUAServer(server_options);
server.on("post_initialize", () => {/**/
});
console.log(chalk.yellow(" server PID :"), process.pid);
try {
await server.start();
} catch (err) {
console.log(" Server failed to start ... exiting");
process.exit(-3);
}
const endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl!;
const opcua = require("node-opcua");
const path = require("path");
const server = new opcua.OPCUAServer({
certificateFile: path.join(__dirname,"../../node-opcua-samples/certificates/server_cert_2048.pem"),
privateKey: path.join(__dirname,"../../node-opcua-samples/certificates/server_key_2018.pem")
});
const addAggregateSupport = require("..").addAggregateSupport;
server.start(function(err){
addAggregateSupport(server.engine.addressSpace);
console.log("err= ",err);
});
var opcua = require("node-opcua");
var min = 1;
var max = 100;
var host = new opcua.OPCUAServer({
buildInfo: {
buildDate: new Date(2018, 8, 8),
buildNumber: "1234",
productName: "productName",
},
port: 4334,
resourcePath: "UA/resourcePath",
});
host.initialize(function () {
var space = host.engine.addressSpace;
var componentOf = space.addObject({
browseName: "browseName",
organizedBy: space.rootFolder.objects,
});