API Docs for: 0.0.57
Show:

OPCUAServer Class

Constructor

OPCUAServer

(
  • options
)

Parameters:

  • options Object
    • [defaultSecureTokenLifetime= 60000] Number optional

      the default secure token life time in ms.

    • [timeout=10000] Number optional

      the HEL/ACK transaction timeout in ms. Use a large value ( i.e 15000 ms) for slow connections or embedded devices.

    • [port= 26543] Number optional

      the TCP port to listen to.

    • [maxAllowedSessionNumber= 10] optional

      the maximum number of concurrent sessions allowed.

    • [nodeset_filename] Array | String optional

      the nodeset.xml files to load

    • [serverInfo= null] optional

      the information used in the end point description

      • [applicationUri= "urn:NodeOPCUA-Server"] String optional
      • [productUri= "NodeOPCUA-Server"] String optional
      • [applicationName] Text: "applicationName" optional
        {LocalizedText}
      • [gatewayServerUri= null] String optional
      • [discoveryProfileUri= null] String optional
      • [discoveryUrls= []] Array optional
    • [securityPolicies= [SecurityPolicy.None,SecurityPolicy.Basic128Rsa15,SecurityPolicy.Basic256]] optional
    • [securityModes= [MessageSecurityMode.NONE,MessageSecurityMode.SIGN,MessageSecurityMode.SIGNANDENCRYPT]] optional
    • [allowAnonymous= true] optional

      tells if the server default endpoints should allow anonymous connection.

    • [userManager= null] optional

      a object that implements user authentication methods

      • [isValidUser] optional
        synchronous function to check the credentials - can be overruled by isValidUserAsync
      • [isValidUserAsync] optional
        asynchronous function to check if the credentials - overrules isValidUser
    • [resourcePath=null] String optional

      resource Path is a string added at the end of the url such as "/UA/Server"

    • [alternateHostname=null] String optional

      alternate hostname to use UserNameIdentityToken is valid.

    • [isAuditing= false] Boolean optional

      true if server shall raise AuditingEvent

Methods

_apply_on_SessionObject

() private

ensure that action is performed on a valid session object,

_on_ActivateSessionRequest

(
  • message
  • channel
)
private

Parameters:

_on_CloseSessionRequest

(
  • message
  • channel
)
private

Parameters:

  • message Object
  • channel Object

_on_FindServersRequest

(
  • message
  • channel
)
private

Parameters:

  • message Object
  • channel Object

_on_GetEndpointsRequest

(
  • message
  • channel
)
private

Parameters:

  • message Object
  • channel Object

addSubscriber add a subscriber to the WatchDog. This method modifies the subscriber be adding a new method to it called 'keepAlive' The subscriber must also provide a "watchdogReset". watchdogReset will be called if the subscriber failed to call keepAlive withing the timeout period.

(
  • subscriber
  • timeout
)
Number

add a subscriber to the WatchDog.

Parameters:

  • subscriber Object
  • timeout Object

Returns:

Number:

bindMethod

(
  • nodeId
  • func
)

Parameters:

  • nodeId NodeId
    the node id of the method
  • func Object
    • inputArguments Array
    • context Object
    • callback Function

browse

(
  • nodesToBrowse
  • [session]
)
BrowseResult[]

Parameters:

Returns:

browsePath

(
  • browsePath
)
BrowsePathResult

Parameters:

  • browsePath Object

Returns:

browseSingleNode

(
  • nodeId
  • browseDescription
  • [session]
)
BrowseResult

Parameters:

  • nodeId NodeId | String
    : the nodeid of the element to browse
  • browseDescription Object
    • browseDirection BrowseDirection

      :

    • referenceTypeId String | NodeId
  • [session] ServerSession optional

Returns:

check_flag

(
  • value
  • mask
)
Boolean

check if a set of bits are set in the values

Parameters:

  • value Object
  • mask Object

Returns:

Boolean:

closeSession

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

Parameters:

  • authenticationToken Object
  • deleteSubscriptions Boolean
    : true if sessions's subscription shall be deleted
  • [reason = "CloseSession"] String optional
    the reason for closing the session (shall be "Timeout", "Terminated" or "CloseSession") what the specs say: ------------------- 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.

createSession

() ServerSession

create and register a new session

Returns:

getChannels

() Array

returns a array of currently active channels

Returns:

Array:

getObjectClassName

(
  • obj
)
String

Parameters:

  • obj Object

Returns:

String:

getSession

(
  • authenticationToken
  • activeOnly
)

Inherited from ServerEngine but overwritten in lib\server\opcua_server.js:397

retrieve a session by authentication token

Parameters:

  • authenticationToken Object
  • activeOnly Object

    search only within sessions that are not closed

historyRead

(
  • historyReadRequest
  • callback
)

Parameters:

historyReadSingleNode

(
  • nodeId
  • attributeId
  • historyReadDetails
  • [timestampsToReturn=TimestampsToReturn.Neither]
  • callback
)

Parameters:

  • nodeId Object
  • attributeId AttributeId
  • historyReadDetails HistoryReadDetails
  • [timestampsToReturn=TimestampsToReturn.Neither] Object optional
  • callback Function

initialize

(
  • done
)
async

Inherited from ServerEngine but overwritten in lib\server\opcua_server.js:421

Initialize the server by installing default node set.

Parameters:

  • done Function

make_debugLog

(
  • script_fullpath
)

Parameters:

  • script_fullpath Object

Returns:

returns a debugLog function that will write message to the console if the DEBUG environment variable indicates that the provided source file shall display debug trace

makeBuffer turn a string make of hexadecimal bytes into a buffer

(
  • listOfBytes
)
Buffer

Parameters:

  • listOfBytes Object

Returns:

Buffer:

Example:

var buffer = makeBuffer("BE EF");

makeServiceFault

(
  • statusCode
  • messages
)

construct a service Fault response

Parameters:

  • statusCode Object
  • messages Object

normalize_require_file

(
  • baseFolder
  • full_path_to_file
)

Parameters:

  • baseFolder Object
  • full_path_to_file Object

Example:

: normalize_require_file("/home/bob/folder1/","/home/bob/folder1/folder2/toto.js").should.eql("./folder2/toto");

read

(
  • readRequest
)
DataValue[]

Parameters:

  • readRequest ReadRequest
    • timestampsToReturn TimestampsToReturn
    • nodesToRead
    • maxAge Number

      maxAge - must be greater or equal than zero. Maximum age of the value to be read in milliseconds. The age of the value is based on the difference between the ServerTimestamp and the time when the Server starts processing the request. For example if the Client specifies a maxAge of 500 milliseconds and it takes 100 milliseconds until the Server starts processing the request, the age of the returned value could be 600 milliseconds prior to the time it was requested. If the Server has one or more values of an Attribute that are within the maximum age, it can return any one of the values or it can read a new value from the data source. The number of values of an Attribute that a Server has depends on the number of MonitoredItems that are defined for the Attribute. In any case, the Client can make no assumption about which copy of the data will be returned. If the Server does not have a value that is within the maximum age, it shall attempt to read a new value from the data source. If the Server cannot meet the requested maxAge, it returns its 'best effort' value rather than rejecting the request. This may occur when the time it takes the Server to process and return the new data value after it has been accessed is greater than the specified maximum age. If maxAge is set to 0, the Server shall attempt to read a new value from the data source. If maxAge is set to the max Int32 value or greater, the Server shall attempt to geta cached value. Negative values are invalid for maxAge.

Returns:

readSingleNode

(
  • nodeId
  • attributeId
  • [timestampsToReturn=TimestampsToReturn.Neither]
)
DataValue

Parameters:

  • nodeId Object
  • attributeId AttributeId
  • [timestampsToReturn=TimestampsToReturn.Neither] Object optional

Returns:

redirectToFile

(
  • tmpfile
  • action_func
  • callback
)

Parameters:

  • tmpfile String

    log file name to redirect console output.

  • action_func Function
    • the inner function to execute
  • callback Object

refreshValues

(
  • nodesToRefresh
  • callback
)
async
performs a call to `asyncRefresh` on all variable nodes that provide an async refresh func.

Parameters: