Ubuntu 22.04, Qt 6.4.0 with QOpcUa. I enable the monitoring of an OpcUa variable in this way:
QOpcUaNode *node = // retrieve the desired node
QOpcUaMonitoringParameters params(1000);
params.setMaxKeepAliveCount(1);
params.setLifetimeCount(3);
QOpcUaNode *node = // retrieve the desired node
node->enableMonitoring(QOpcUa::NodeAttribute::Value, params);
In the factory we have two different type of machines (from different manufacturers). In both we have some variables that are almost steady, it means they change their values very seldom - even once a day.
With this code I'm able to keep the connection alive for one of these machines. On the others the connection is closed by the server every few minutes - no matter the values of the parameters above - with the following reasons:
"Received a ServiceFault response"
"The ServiceResult has the StatusCode BadTimeout"
"Received Timeout for Publish Response"
"The ServiceResult has the StatusCode BadNoSubscription"
I'm aware the parameters should match the "speed of change" of the variables in order to optimize the publishing interval and notifications handling. I also tried 1000 and 3000 with just a little change in the behavior (the connection survived a little longer, but still in the order of minutes).
I also tried to add a poll of a variable every few second with the hope of keeping the connection open. Instead the server closes the connection anyway - my guess is that the monitor handling has the precedence.
Please note that if I enable the monitoring for the variables that change the value constantly the connection does not drop at all.
I have two simple questions:
- what are the right settings to monitor a steady variable?
- should not the server still push a notification even if the variable has not changed to keep alive the connection?
Basically, I'm trying to figure out if I can do anything on my side or it is the server that does not handle the connection correctly.
This hasn't anything to do with the subscription values, if they change or not. You have to do other requests like read, write to keep a session alive. My tipp just read a variable every 10 seconds or so. A possible variable is the server status.