In Server how to know which variables client has subscribed

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
anikettakalkar
Jr. Member
Jr. Member
Posts: 1
Joined: 09 Feb 2018, 05:10

In Server how to know which variables client has subscribed

Post by anikettakalkar »

I am developing OPC UA server, having around 10000 variables. I don't want to maintain any cache so I want to use Internal Handle Type and only update those variable values which client has monitor/subscribed for.
I read http://documentation.unified-automation ... deMan.html but couldn't understand how to accomplish the same.

How do I provide initial value to the variables ?
Which method/event should I use to get the variable ids for which client has subscribed(monitor) and unsubscribed ? (As server consists of 10000 variables and client may subscribe/monitor only few variables.)

martenbyebye
Hero Member
Hero Member
Posts: 21
Joined: 03 Mar 2017, 16:08

Re: In Server how to know which variables client has subscri

Post by martenbyebye »

Hi,

Question no 1. What about writing to the nodes just after creating them?:

Code: Select all

this.nodeManager.Server.InternalClient.WriteValue(this.nodeManager.Server.DefaultRequestContext, nodeId,qualifiedName, value);
Question no 2. What about overwriting the Start/Stop DataMonitoring method in your NodeManager class?

Code: Select all

        protected override DataMonitoringResult StartDataMonitoring(
            RequestContext context,
            MonitoredItemHandle itemHandle,
            MonitoredItemCreateRequest settings,
            DataChangeEventHandler callback)
        {
            this.monitoredItems.Add(settings.ItemToMonitor); // Here to add to the list. In the StopDataMonitoring to remove from the list.
            return base.StartDataMonitoring(context, itemHandle, settings, callback);
        }

        protected override void StartDataMonitoring(
            RequestContext context,
            TransactionHandle transaction,
            IList<NodeAttributeOperationHandle> operationHandles,
            IList<uint> monitoredItemIds,
            IList<MonitoredItemCreateRequest> settings,
            IList<DataChangeEventHandler> callback)
        {
            // Maybe also here. 
            base.StartDataMonitoring(context, transaction, operationHandles, monitoredItemIds, settings, callback);
        }

Post Reply