You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While dealing with non quite stable PLCs I noticed that sometimes in response to any request PLC can answer with StatusBadSessionNotActivated. After quite a lot of debugging, reading the standard and the code, I figured, that library doesn't have a bug with sessions activation. But @magiconair brought my attention to the fact the Client has public API to control different aspects of session creation: CreateSessionWithContext and ActivateSessionWithContext. Yes, this makes library extremely robust, but on the other hand, it probably make sense then to add StatusBadSessionNotActivated handling to that switch (https://github.com/gopcua/opcua/blob/main/client.go#L297) and do restoreSession action.
The other option, probably more cleaner, will be to make session API private, since then Client will correctly handle session as is it now.
This issue is to discuss preferred approach going forward.
The text was updated successfully, but these errors were encountered:
Is there any use-case where clients would need to create/activate sessions manually? This is all handled in the client and the client also has the monitor loop without nothing really works. We will break the API with v0.5 anyway so we could do this then.
There is the crypto example which uses ActivateSession and DeactivateSession to move a session between client connections. It feels a bit contrived but maybe there is the use-case that you connect on one address, establish the session, and then move that session to another connection.
While dealing with non quite stable PLCs I noticed that sometimes in response to any request PLC can answer with
StatusBadSessionNotActivated
. After quite a lot of debugging, reading the standard and the code, I figured, that library doesn't have a bug with sessions activation. But @magiconair brought my attention to the fact theClient
has public API to control different aspects of session creation:CreateSessionWithContext
andActivateSessionWithContext
. Yes, this makes library extremely robust, but on the other hand, it probably make sense then to addStatusBadSessionNotActivated
handling to thatswitch
(https://github.com/gopcua/opcua/blob/main/client.go#L297) and dorestoreSession
action.The other option, probably more cleaner, will be to make session API private, since then
Client
will correctly handle session as is it now.This issue is to discuss preferred approach going forward.
The text was updated successfully, but these errors were encountered: