How to use the node-opcua-common.ServerDiagnosticsSummaryDataType function in node-opcua-common

To help you get started, we’ve selected a few node-opcua-common 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 / source / server_engine.ts View on Github external
// to do when spec is clear about what goes here!
    // spec 1.04 says (in Part 4 7.33 SignedSoftwareCertificate
    // Note: Details on SoftwareCertificates need to be defined in a future version.
    this.serverCapabilities.softwareCertificates = [
      // new SignedSoftwareCertificate({})
    ];

    // make sure minSupportedSampleRate matches MonitoredItem.minimumSamplingInterval
    (this.serverCapabilities as any).__defineGetter__("minSupportedSampleRate", () => {
      return MonitoredItem.minimumSamplingInterval;
    });

    this.historyServerCapabilities = new HistoryServerCapabilities(options.historyServerCapabilities);

    // --------------------------------------------------- serverDiagnosticsSummary extension Object
    this.serverDiagnosticsSummary = new ServerDiagnosticsSummaryDataType();
    assert(this.serverDiagnosticsSummary.hasOwnProperty("currentSessionCount"));

    // note spelling is different for serverDiagnosticsSummary.currentSubscriptionCount
    //      and sessionDiagnostics.currentSubscriptionsCount ( with an s)
    assert(this.serverDiagnosticsSummary.hasOwnProperty("currentSubscriptionCount"));

    (this.serverDiagnosticsSummary as any).__defineGetter__("currentSubscriptionCount", () => {
      // currentSubscriptionCount returns the total number of subscriptions
      // that are currently active on all sessions
      let counter = 0;
      _.values(this._sessions).forEach((session: ServerSession) => {
        counter += session.currentSubscriptionCount;
      });
      return counter;
    });