Server events #1268
Replies: 3 comments 1 reply
-
Hey Elias, the line you may looking for is this one: python-opcua/opcua/server/address_space.py Line 687 in 0d595e5 With these you can add a callback, in case something changes, to your Node (even for other attributes, but value is the common one). You can even add more than one callback. You may have to use partial ´, depending on what kind of action you want to do. Keep in mind, that these functions shouldn't consume much time. Like in SubHandler, they will otherwise block the server. Cheers! |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for the feedback @swamper123 ! |
Beta Was this translation helpful? Give feedback.
-
You don't need to create a client. The server has nearly all the same methods that a client has because much of it is shared between them. The server can use the methods in the node class or create subscriptions on its own. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am using this library for a university project.
Currently, I am developing my project in Docker, which works great.
I have one container where a server is running, and another container with a client.
The client changes a value in the server with the '.set_value()' method.
I was wondering if it's possible to have the server act on a data change in its address space.
(Client sets value in server, server notices that a value has been set and performs some king of action.)
Here I have a diagram:
One solution is to have an extra client on the servers host subscribe to that node in the server, and perform the desired action in the datachange_notification SubHandler function. I was just wondering if the server could do this without needing an extra client. It seems kind of redundant to make a client on host 1, just to perform an action when the value of a variable node in the server changes.
The thing I need is some kind of event handler on the server, that triggers when a given node's value changes.
I have seen the 'server_events' example but it's not clear to me what it does. Information about this topic is sparse on the internet. Maybe I just want to do something that is not possible.
Does anyone have any info / tips for me?
Thanks in advance,
Kind regards
Beta Was this translation helpful? Give feedback.
All reactions