Node-RED: Modify node-red-contrib-opcua keepSessionAlive

I am using Node-RED for communication with OPC UA Server. I installed the node-red-contrib-opcua Node for this purpose. Everything is working fine, but in some cases, I would like to change the OpcUa-Client keepSessionAlive property to false. Default is true. I did not find it in the node property window. Is there a solution for it?

image

[{"id":"29c4b9f87fcbed0a","type":"OpcUa-Item","z":"4566de58de158f7c","item":"ns=3;s=\"DB\".\"BadParts\"","datatype":"String","value":"","name":"BadParts","x":1180,"y":920,"wires":[["9eaf1c412227d061"]]},{"id":"9eaf1c412227d061","type":"OpcUa-Client","z":"4566de58de158f7c","endpoint":"ac342db8.435e1","action":"read","deadbandtype":"a","deadbandvalue":1,"time":10,"timeUnit":"s","certificate":"n","localfile":"","localkeyfile":"","securitymode":"None","securitypolicy":"None","folderName4PKI":"","name":"OPC UA","x":1370,"y":920,"wires":[["4e79b81b818bf8f2"]]},{"id":"4e79b81b818bf8f2","type":"debug","z":"4566de58de158f7c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1530,"y":920,"wires":[]},{"id":"38cd6b7326408150","type":"inject","z":"4566de58de158f7c","name":"","props":[{"p":"payload"},{"p":"keepSessionAlive","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":970,"y":920,"wires":[["29c4b9f87fcbed0a"]]},{"id":"ac342db8.435e1","type":"OpcUa-Endpoint","endpoint":"opc.tcp://192.168.0.16:4840","secpol":"None","secmode":"None","login":false}]

image

I can add it.. just new feature that will help perhaps sometimes embedded servers can provide just up to 5 open sessions.

1 Like

Hello @mikakaraila,
yes, this is exactly my case. On the other side is a small OPC UA Server with a strict open session limit.
I new feature will be great.
Thank you for your help!

There was similar kind of problem, one solution is to use one client node and then msg.action to read/write etc. so it uses same session for everything.
Look example in the issue: Connection Node-Red with S7 - Error-BadTooManySessions · Issue #428 · mikakaraila/node-red-contrib-opcua · GitHub

Hello @mikakaraila,
thanks a lot for the link.
I am also using one OPC UA Client for multiple jobs. This is working very well, if you have one flow. As soon as you begin with multiple sub-flows with theirs own OPC UA communication, you will need additional OPC UA Clients. Therefore, I see a keepSessionAlive boolean property practical. Some values are also read/written only sometimes and there is no need to hold the session alive.

That would be a really nice feature to have; most PLCs allow a small number of client sessions at the same time.