Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function findActiveConditions(session: ClientSession): Promise {
const request: CreateSubscriptionRequestOptions = {
maxNotificationsPerPublish: 10000,
priority: 6,
publishingEnabled: true,
requestedLifetimeCount: 1000,
requestedMaxKeepAliveCount: 100,
requestedPublishingInterval: 100,
};
const subscription = await session.createSubscription2(request);
const itemToMonitor: ReadValueIdOptions = {
attributeId: AttributeIds.EventNotifier,
nodeId: resolveNodeId("Server"), // i=2253
};
const fields = await extractConditionFields(session, "AcknowledgeableConditionType");
const eventFilter = constructEventFilter(fields, [resolveNodeId("AcknowledgeableConditionType")]);
const monitoringParameters: MonitoringParametersOptions = {
discardOldest: false,
filter: eventFilter,
queueSize: 100,
samplingInterval: 0,
};
const event_monitoringItem =
await subscription.monitor(itemToMonitor, monitoringParameters, TimestampsToReturn.Both);