How to use the node-opcua-service-subscription.DataChangeNotification function in node-opcua-service-subscription

To help you get started, we’ve selected a few node-opcua-service-subscription 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_subscription.ts View on Github external
// separate data for DataChangeNotification (MonitoredItemNotification) from data for
      // EventNotificationList(EventFieldList)
      const dataChangedNotificationData = notifications_chunk.filter(
        filter_instanceof.bind(null, MonitoredItemNotification));
      const eventNotificationListData = notifications_chunk.filter(
        filter_instanceof.bind(null, EventFieldList));

      assert(notifications_chunk.length ===
        dataChangedNotificationData.length + eventNotificationListData.length);

      notifications = [];

      // add dataChangeNotification
      if (dataChangedNotificationData.length) {
        const dataChangeNotification = new DataChangeNotification({
          diagnosticInfos: [],
          monitoredItems: dataChangedNotificationData
        });
        notifications.push(dataChangeNotification);
      }

      // add dataChangeNotification
      if (eventNotificationListData.length) {
        const eventNotificationList = new EventNotificationList({
          events: eventNotificationListData
        });

        notifications.push(eventNotificationList);
      }

      assert(notifications.length === 1 || notifications.length === 2);