How to use the node-opcua-service-discovery.ServerOnNetwork function in node-opcua-service-discovery

To help you get started, we’ve selected a few node-opcua-service-discovery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-server-discovery / src / opcua_discovery_server.js View on Github external
// },
            debugLog("a new OPCUA server has been registered");

            const recordId = ++this.recordId;
            const serverName = service.name;

            service.txt.caps = service.txt.caps || "";
            let serverCapabilities = service.txt.caps.split(",").map(x => x.toUpperCase()).sort();

            assert(serverCapabilities instanceof Array);

            const path = service.txt.path || "";
            const discoveryUrl = "opc.tcp://" + service.host + ":" + service.port + path;

            this.registeredServers.push(
                new discovery_service.ServerOnNetwork({
                    recordId: recordId,
                    serverName: serverName,
                    discoveryUrl: discoveryUrl,
                    serverCapabilities: serverCapabilities
                }));
            this.lastUpdateDate = new Date(Date.now());
        };
github node-opcua / node-opcua / packages / node-opcua-server-discovery / source / mdns_responder.ts View on Github external
}

            this.recordId++;
            const recordId = this.recordId;
            const serverName = service.name;

            service.txt = service.txt || {};
            const service_txt =  service.txt as any;
            service_txt.caps = service_txt.caps || "";
            const serverCapabilities = service_txt.caps.split(",").map((x: string) => x.toUpperCase()).sort();

            const path = service_txt.path || "";
            const discoveryUrl = "opc.tcp://" + service.host + ":" + service.port + path;

            this.registeredServers.push(
              new ServerOnNetwork({
                  discoveryUrl,
                  recordId,
                  serverCapabilities,
                  serverName
              }));
            this.lastUpdateDate = new Date(Date.now());

            debugLog("a new OPCUA server has been registered on mDNS", service.name, recordId);

        };