Skip to content

Multiple subscriptions and unsubscriptions handling #1476

Answered by schroeder-
MacherelR asked this question in Q&A
Discussion options

You must be logged in to vote

You can just add new nodes to your subscription, when ever you want. You don't create a new subscription, just call subscribe_data_change to the new node.

    found_node = self.client.get_node(nodeid=self.node_id)
    found_node_name = await found_node.read_browse_name()
    self.node_map[self.node_id] = found_node_name.Name
    handler = SubHandler(self.node_map, producer=self.producer)
    self.sub = await self.client.create_subscription(period=1000,handler=handler)
    node = self.client.get_node(self.node_id)
    self.monitored_item = await self.sub.subscribe_data_change(node)
    .... 
    # do things
    new_node = self.client.get_node(self.new_node_id)
    await self.sub.subscribe_…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MacherelR
Comment options

Answer selected by MacherelR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants