Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the Client/Connection send out 'events' or notify in case the status of the connection changes? #741

Open
Wafje opened this issue Aug 30, 2024 · 1 comment · May be fixed by #767
Open
Milestone

Comments

@Wafje
Copy link

Wafje commented Aug 30, 2024

Does the Client/Connection send out 'events' in case the status of the connection changes?

The client keep track of the connection state:

const (
	// Closed, the Connection is currently closed
	Closed [ConnState](https://pkg.go.dev/github.com/gopcua/opcua#ConnState) = [iota](https://pkg.go.dev/builtin#iota)
	// Connected, the Connection is currently connected
	Connected
	// Connecting, the Connection is currently connecting to a server for the first time
	Connecting
	// Disconnected, the Connection is currently disconnected
	Disconnected
	// Reconnecting, the Connection is currently attempting to reconnect to a server it was previously connected to
	Reconnecting
)

Is there a way to get notified when the value changes?

@magiconair
Copy link
Member

Looking at https://github.com/gopcua/opcua/blob/main/client.go#L648-L658 the answer is No but it probably should. I'll create a PR

@magiconair magiconair added this to the v0.7.1 milestone Feb 9, 2025
magiconair added a commit that referenced this issue Feb 9, 2025
magiconair added a commit that referenced this issue Feb 9, 2025
Add support for an optional channel to receive client state changes.

Fixes #741
@magiconair magiconair linked a pull request Feb 9, 2025 that will close this issue
magiconair added a commit that referenced this issue Feb 9, 2025
Add support for an optional channel to receive client state changes.

Fixes #741
magiconair added a commit that referenced this issue Feb 9, 2025
Add support for an optional channel to receive client state changes.

Fixes #741
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 a pull request may close this issue.

2 participants