Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert(this.server!.serverType !== undefined,
" must have a valid server Type");
// construct connection
const server = this.server!;
const selectedEndpoint = this.selectedEndpoint;
if (!selectedEndpoint) {
console.log("Warning : cannot register server - no endpoint available");
return outer_callback(new Error("Cannot registerServer"));
}
const options = {
securityMode: selectedEndpoint.securityMode,
securityPolicy: coerceSecurityPolicy(selectedEndpoint.securityPolicyUri),
serverCertificate: selectedEndpoint.serverCertificate,
certificateFile: server.certificateFile,
privateKeyFile: server.privateKeyFile,
clientName: "RegistrationClient-2",
connectionStrategy: no_reconnect_connectivity_strategy
};
const client = OPCUAClientBase.create(options);
const tmp = this._serverEndpoints;
(client as any)._serverEndpoints = tmp;
(server as any)._registration_client = client;
const theStatus = isOnline
assert(self.selectedEndpoint || "must have a selected endpoint => please call _establish_initial_connection");
assert(self.server.serverType !== undefined, " must have a valid server Type");
assert(self.discoveryServerEndpointUrl);
// construct connection
const server = this.server;
const selectedEndpoint = self.selectedEndpoint;
if (!selectedEndpoint) {
console.log("Warning : cannot register server - no endpoint avaialble");
return outer_callback(new Error("Cannot registerServer"));
}
const options = {
securityMode: selectedEndpoint.securityMode,
securityPolicy: coerceSecurityPolicy(selectedEndpoint.securityPolicyUri),
serverCertificate: selectedEndpoint.serverCertificate,
certificateFile: server.certificateFile,
privateKeyFile: server.privateKeyFile,
connectionStrategy: no_reconnect_connectivity_strategy,
clientName: "RegistrationClient-2"
};
const tmp = self._serverEndpoints;
let client = OPCUAClientBase.create(options);
client._serverEndpoints = tmp;
server._registration_client = client;
const theStatus =isOnline ? RegisterServerManagerStatus.REGISTERING :RegisterServerManagerStatus.UNREGISTERING;
self._setState(theStatus);