1

I am writing app using nodeOPCUA. I want to create client and monitor variables.

const subscription = await session.createSubscription2({
      requestedPublishingInterval: 2000, 
      requestedMaxKeepAliveCount: 20, 
      requestedLifetimeCount: 6000,
      maxNotificationsPerPublish: 1000,
      publishingEnabled: true,
      priority: 10,
    });

But my test variable is only monitored for small amount of time. I want to create endless subcription. Is there any chance to do it?

Corest
  • 19
  • 3
  • Your OPC UA Client shall send enough PublishRequest for the server to not consider the Subscription "invalid". – Camille G. Jul 03 '20 at 07:30

1 Answers1

0

A subscription is only kept for the specified lifetime. Either you set the lifetime higher, which can be refused by the server. Or you keep making publish requests periodically.

const publishRequest = new opcua.subscription_service.PublishRequest({});
session.performMessageTransaction(publishRequest, function (err, response) {
  callback(err, response);
});
JerMah
  • 693
  • 5
  • 17