Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert(request.hasOwnProperty("requestedMaxKeepAliveCount")); // Counter
assert(request.hasOwnProperty("maxNotificationsPerPublish")); // Counter
assert(request.hasOwnProperty("publishingEnabled")); // Boolean
assert(request.hasOwnProperty("priority")); // Byte
const subscription = new Subscription({
publishingInterval: request.requestedPublishingInterval,
lifeTimeCount: request.requestedLifetimeCount,
maxKeepAliveCount: request.requestedMaxKeepAliveCount,
maxNotificationsPerPublish: request.maxNotificationsPerPublish,
publishingEnabled: request.publishingEnabled,
priority: request.priority,
id: _get_next_subscriptionId(),
// -------------------
publishEngine: session.publishEngine, //
sessionId: NodeId.NullNodeId
});
// add subscriptionDiagnostics
engine._exposeSubscriptionDiagnostics(subscription);
assert(subscription.publishEngine === session.publishEngine);
session.publishEngine.add_subscription(subscription);
subscription.once("terminated",function() {
const subscription = this;
engine._unexposeSubscriptionDiagnostics(subscription);
});
return subscription;
};