opcmilo

Eclipse milo - OPCUA - What is the best practice to inform server (value/node) changes to the client to trigger a refresh?


I am getting started with OPCUA and eclipse milo and I am trying to understand how to best inform the client that a value or node has changed in the server.

So far my guess is that I need to trigger an event in the node that has changed, and then the client should monitor/subscribe to events in such node. Am I right on this?

If my understanding is correct, which event is most appropriated to trigger for this purpose?

I am using a free UI OPCUA client to test my server changes, and I need to refresh manually to observe my changes. I was expecting that by triggering the correct (OPCUA standard) event I would indicate the client to refresh automatically, is this possible?

Thanks!


Solution

  • You don't need Events to notify a client of an attribute change - that's the entire point of Subscriptions and MonitoredItems.

    The client creates a MonitoredItem for the Value attribute (or any other attribute) and the server will report changes when that attribute changes.

    As far as what you need to do as a user of the Milo Server SDK - see the ExampleNamespace. Your namespace implements the onDataItemCreated and other related methods to be notified that a client has created a MonitoredItem and you should start sampling values for it.