Skip to content

Conversation

@OptrixAU
Copy link

In applications involving subscribing to data and waiting for data to stream in, there's no clear way to check if the client has been disconnected (for example, by shutting down the OPC-UA server).

This function isn't intended to check if a connection was initially successful (although theoretically it would do that too) - the intention is to check to see if the connection has been dropped.

Usage Pattern:
In my application, after 10 seconds with no new incoming data from the subscription, I check to see if the connection is alive. If it's still alive, it's just a lull in data, but if it's dead, we need to disconnect, reconnect and resubscribe to keep up-to-date with new data.

@oroulet
Copy link
Member

oroulet commented Feb 26, 2020

checking that the thread is alive does not tell us of communication is OK or not. The only real way we have to know if we are connected is to try to read a node. In fact reading the server state node is the best as the server mught be on but in a bad state. This is done in KeepAlive class.
So maybe you could write something like*
server_state = self.client.get_node(ua.FourByteNodeId(ua.ObjectIds.Server_ServerStatus_State))
and then check the value is correct inside that a method called is_connection_ok() or similar

@oroulet
Copy link
Member

oroulet commented Feb 29, 2020

Did open other PR? Icannot see them now

@OptrixAU
Copy link
Author

OptrixAU commented Feb 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants