Skip to content

Commit

Permalink
Expose RevisedSessionTimeout on Session.
Browse files Browse the repository at this point in the history
Clients might benefit from knowing the value communicated by OPCUA server
  • Loading branch information
bitomaxsp committed May 22, 2023
1 parent c263e7c commit f4e2daf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,15 @@ type Session struct {
// Session response. Used to generate the signatures for the ActivateSessionRequest
// and User Authorization
serverNonce []byte

// revisedTimeout is the actual maximum time that a Session shall remain open without activity.
revisedTimeout time.Duration
}

// RevisedTimeout return actual maximum time that a Session shall remain open without activity.
// This value is provided by the server in response to CreateSession.
func (s *Session) RevisedTimeout() time.Duration {
return s.revisedTimeout
}

// CreateSession creates a new session which is not yet activated and not
Expand Down Expand Up @@ -771,6 +780,7 @@ func (c *Client) CreateSessionWithContext(ctx context.Context, cfg *uasc.Session
resp: res,
serverNonce: res.ServerNonce,
serverCertificate: res.ServerCertificate,
revisedTimeout: time.Duration(res.RevisedSessionTimeout) * time.Millisecond,
}

return nil
Expand Down

0 comments on commit f4e2daf

Please sign in to comment.