APIs

Show:

A Server session object. from OPCUA Spec 1.02:

  • Sessions are created to be independent of the underlying communications connection. Therefore, if a communication connection fails, the Session is not immediately affected. The exact mechanism to recover from an underlying communication connection error depends on the SecureChannel mapping as described in Part 6.
  • Sessions are terminated by the Server automatically if the Client fails to issue a Service request on the Session within the timeout period negotiated by the Server in the CreateSession Service response. This protects the Server against Client failures and against situations where a failed underlying connection cannot be re-established.
  • Clients shall be prepared to submit requests in a timely manner to prevent the Session from closing automatically.
  • Clients may explicitly terminate Sessions using the CloseSession Service.
  • When a Session is terminated, all outstanding requests on the Session are aborted and Bad_SessionClosed StatusCodes are returned to the Client. In addition, the Server deletes the entry for the Client from its SessionDiagnosticsArray Variable and notifies any other Clients who were subscribed to this entry.

Constructor

ServerSession

(
  • parent
  • sessionTimeout
)
private

Parameters:

  • parent SessionEngine
  • sessionTimeout Number

Methods

close

(
  • deleteSubscriptions
  • [reason = "CloseSession"]
)

close a ServerSession, this will also delete the subscriptions if the flag is set.

Spec extract:

If a Client invokes the CloseSession Service then all Subscriptions associated with the Session are also deleted if the deleteSubscriptions flag is set to TRUE. If a Server terminates a Session for any other reason, Subscriptions associated with the Session, are not deleted. Each Subscription has its own lifetime to protect against data loss in the case of a Session termination. In these cases, the Subscription can be reassigned to another Client before its lifetime expires.

Parameters:

  • deleteSubscriptions Boolean

    : should we delete subscription ?

  • [reason = "CloseSession"] String optional

    the reason for closing the session (shall be "Timeout", "Terminated" or "CloseSession")

deleteSubscription

(
  • subscriptionId
)
StatusCode

Parameters:

  • subscriptionId Number

Returns:

getSubscription

(
  • subscriptionId
)
Subscription

retrieve an existing subscription by subscriptionId

Parameters:

  • subscriptionId Number

Returns:

onClientSeen required for watch dog

(
  • currentTime
)
private

Parameters:

  • currentTime DateTime

watchdogReset used as a callback for the Watchdog

() private

Properties

continuationPointManager

ContinuationPointManager

the continuation point manager for this session

cumulatedSubscriptionCount

Number

number of subscriptions ever created since this object is live

currentMonitoredItemCount

Number

number of monitored items

currentSubscriptionCount

Number

number of active subscriptions

Events

session_closed

Event Payload:

  • deleteSubscriptions Boolean
  • reason String