Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// --------------------------------------------------- ServerCapabilities
options.serverCapabilities = options.serverCapabilities || {};
options.serverCapabilities.serverProfileArray = options.serverCapabilities.serverProfileArray || [
"Standard UA Server Profile",
"Embedded UA Server Profile",
"Micro Embedded Device Server Profile",
"Nano Embedded Device Server Profile"
];
options.serverCapabilities.localeIdArray = options.serverCapabilities.localeIdArray || ["en-EN", "fr-FR"];
engine.serverCapabilities = new ServerCapabilities(options.serverCapabilities);
engine.historyServerCapabilities = new HistoryServerCapabilities(options.historyServerCapabilities);
// --------------------------------------------------- serverDiagnosticsSummary extension Object
engine.serverDiagnosticsSummary = new ServerDiagnosticsSummary({});
assert(engine.serverDiagnosticsSummary.hasOwnProperty("currentSessionCount"));
// note spelling is different for serverDiagnosticsSummary.currentSubscriptionCount
// and sessionDiagnostics.currentSubscriptionsCount ( with an s)
assert(engine.serverDiagnosticsSummary.hasOwnProperty("currentSubscriptionCount"));
engine.serverDiagnosticsSummary.__defineGetter__("currentSubscriptionCount", function () {
// currentSubscriptionCount returns the total number of subscriptions
// that are currently active on all sessions
let counter = 0;
_.values(engine._sessions).forEach(function (session) {
counter += session.currentSubscriptionCount;
});
return counter;
});