This module, `node-opcua-server-discovery`, is a core component of the `node-opcua` SDK, a pure Node.js implementation of the OPC UA specification. It provides the functionality for OPC UA servers to register themselves with a Local Discovery Server (LDS) or for clients to discover available OPC UA servers on a network. The package is currently at version 2.169.0 and maintains a highly active release cadence, often publishing updates multiple times a month, focusing on stability, performance, OPC UA 1.05 compliance, and enhanced security features like certificate management. Its key differentiators include being a complete, native JavaScript/TypeScript implementation, offering strong support for modern Node.js environments, and a consistent focus on optimizing transport, memory, and protocol robustness.
npm install node-opcua-server-discoveryVerified import paths — ran on the pinned version, not inferred.
This code snippet demonstrates how to initialize and start an OPC UA Local Discovery Server (LDS) using `node-opcua-server-discovery`. It includes essential steps for certificate management, defining server information, and graceful shutdown. This LDS can then be used by other OPC UA servers to register themselves, and by clients to discover available services.
Review and update any custom event handlers or modules that might be interacting with the internal event system or relying on `async`/`lodash` utilities directly. Consult `node-opcua`'s main documentation for updated event patterns.
For servers running behind network address translation (NAT), Docker port-mapping, or reverse proxies, ensure the `advertisedEndpoints` option is correctly configured with the publicly accessible endpoint URLs. Validate these URLs from the client's perspective.
If your application uses custom OPC UA DataTypes or relies on specific encoding/decoding behaviors, thoroughly test against `v2.163.0` and later versions. Ensure your information models strictly adhere to OPC UA 1.05 specifications. Re-evaluate any custom extension object or variant handling.
Always ensure your `OPCUADiscoveryServer` instance has a valid `CertificateManager` configured with appropriate certificates. For client-server communication via discovery, ensure that both the discovery server and the registered OPC UA servers have trusted certificates configured on both sides.
Ensure the server's certificate is in the client's trusted certificates store, and vice versa. Verify that the `applicationUri` in the certificate matches the server's configured URI and that DNS names/IPs in the certificate match the endpoint URL used for connection. Regenerate certificates if necessary, ensuring proper hostnames/IPs.
Check network connectivity between client and server, including firewall rules on both ends (port 4840 for LDS, default 4840 or custom for OPC UA servers). Verify the endpoint URL is correct and accessible. Review server logs for errors related to connection establishment or certificate rejection.
Ensure the `OPCUADiscoveryServer` constructor is called with all required options, including `port`, `serverInfo`, and `certificateManager`. Double-check the types and availability of these properties before passing them to the constructor.
No dependency data recorded yet.