OPCUAServer Class
Constructor
OPCUAServer
        
                - 
                                
options 
Parameters:
- 
                                
optionsObject- 
                                            
[defaultSecureTokenLifetime= 60000]Number optionalthe default secure token life time in ms.
 - 
                                            
[timeout=10000]Number optionalthe HEL/ACK transaction timeout in ms. Use a large value ( i.e 15000 ms) for slow connections or embedded devices.
 - 
                                            
[port= 26543]Number optionalthe TCP port to listen to.
 - 
                                            
[maxAllowedSessionNumber= 10]optionalthe maximum number of concurrent sessions allowed.
 - 
                                            
[nodeset_filename]Array| String optionalthe nodeset.xml files to load
 - 
                                            
[serverInfo= null]optionalthe 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= []]Arrayoptional  
 - 
                                                        
 - 
                                            
[securityPolicies= [SecurityPolicy.None,SecurityPolicy.Basic128Rsa15,SecurityPolicy.Basic256]]optional - 
                                            
[securityModes= [MessageSecurityMode.NONE,MessageSecurityMode.SIGN,MessageSecurityMode.SIGNANDENCRYPT]]optional - 
                                            
[disableDiscovery= false]optionaltrue if Discovery Service on unsecure channel shall be disabled
 - 
                                            
[allowAnonymous= true]optionaltells if the server default endpoints should allow anonymous connection.
 - 
                                            
[userManager= null]optionala object that implements user authentication methods
- 
                                                        
[isValidUser]optionalsynchronous function to check the credentials - can be overruled by isValidUserAsync - 
                                                        
[isValidUserAsync]optionalasynchronous function to check if the credentials - overrules isValidUser - 
                                                        
[getUserRole]optionalsynchronous function to return the role of the given user 
 - 
                                                        
 - 
                                            
[resourcePath=null]String optionalresource Path is a string added at the end of the url such as "/UA/Server"
 - 
                                            
[alternateHostname=null]String optionalalternate hostname to use
 - 
                                            
[maxConnectionsPerEndpoint=null]optional - 
                                            
[serverCapabilities]optionalUserNameIdentityToken is valid.
 - 
                                            
[isAuditing= false]Boolean optionaltrue if server shall raise AuditingEvent
 - 
                                            
[registerServerMethod= RegisterServerMethod.HIDDEN]RegisterServerMethod optional - 
                                            
[discoveryServerEndpointUrl= "opc.tcp://localhost:4840"]optional - 
                                            
[capabilitiesForMDNS= ["NA"]]Arrayoptional supported server capabilities for the Mutlicast (mDNS) (any of node-opcua-discovery.serverCapabilities)
 
 - 
                                            
 
Item Index
Methods
- _apply_on_SessionObject
 - _apply_on_Subscription
 - _apply_on_SubscriptionIds
 - _apply_on_Subscriptions
 - _createSubscriptionOnSession
 - _on_ActivateSessionRequest
 - _on_BrowseNextRequest
 - _on_BrowseRequest
 - _on_CloseSessionRequest
 - _on_FindServersRequest
 - _on_GetEndpointsRequest
 - bindMethod
 - browse
 - browsePath
 - browseSingleNode
 - closeSession
 - createSession
 - getChannels
 - getSession
 - historyRead
 - historyReadSingleNode
 - initialize
 - iterate_on_signed_message_chunks
 - makeServiceFault
 - read
 - readSingleNode
 - refreshValues
 - registerServer
 - registerShutdownTask
 - resumeEndPoints
 - secondsTillShutdown
 - shutdown
 - start
 - suspendEndPoints
 - transferSubscription
 - userNameIdentityTokenAuthenticateUser
 - write
 - writeSingleNode
 
Properties
- allowAnonymous
 - buildInfo
 - bytesRead
 - bytesWritten
 - cumulatedSessionCount
 - cumulatedSubscriptionCount
 - currentChannelCount
 - currentSessionCount
 - currentSubscriptionCount
 - initialized
 - maxAllowedSessionNumber
 - maxConnectionsPerEndpoint
 - publishingIntervalCount
 - rejectedSessionCount
 - rejectedSessionCount
 - serverName
 - serverNamespaceName
 - serverNameUrn
 - serverType
 - sessionAbortCount
 - transactionsCount
 
Methods
_apply_on_SessionObject
                    
                            - 
                                            
ResponseClass - 
                                            
message - 
                                            
channel - 
                                            
action_to_perform 
ensure that action is performed on a valid session object,
Parameters:
- 
                                            
ResponseClassConstructorthe constructor of the response Class
 - 
                                            
messageObject - 
                                            
channelObject - 
                                            
action_to_performFunction- 
                                                        
sessionServerSession - 
                                                        
sendResponseFunction- 
                                                                    
responseResponseClass 
 - 
                                                                    
 - 
                                                        
sendErrorFunction- 
                                                                    
statusCodeStatusCode - 
                                                                    
diagnosticsDiagnosticsInfo 
 - 
                                                                    
 
 - 
                                                        
 
_apply_on_Subscription
                    
                            - 
                                            
ResponseClass - 
                                            
message - 
                                            
channel - 
                                            
action_to_perform 
Parameters:
- 
                                            
ResponseClassObject - 
                                            
messageObject - 
                                            
channelObject - 
                                            
action_to_performObject 
_apply_on_SubscriptionIds
                    
                            - 
                                            
ResponseClass - 
                                            
message - 
                                            
channel - 
                                            
action_to_perform 
Parameters:
- 
                                            
ResponseClassObject - 
                                            
messageObject - 
                                            
channelObject - 
                                            
action_to_performObject 
_apply_on_Subscriptions
                    
                            - 
                                            
ResponseClass - 
                                            
message - 
                                            
channel - 
                                            
action_to_perform 
Parameters:
- 
                                            
ResponseClassObject - 
                                            
messageObject - 
                                            
channelObject - 
                                            
action_to_performObject 
_createSubscriptionOnSession
                    
                            - 
                                            
request 
Parameters:
- 
                                            
requestObject- 
                                                        
requestedPublishingIntervalDuration - 
                                                        
requestedLifetimeCountCounter - 
                                                        
requestedMaxKeepAliveCountCounter - 
                                                        
maxNotificationsPerPublishCounter - 
                                                        
publishingEnabledBoolean - 
                                                        
priorityByte 
 - 
                                                        
 
Returns:
_on_ActivateSessionRequest
                    
                            - 
                                            
message - 
                                            
channel 
Parameters:
- 
                                            
messageBuffer - 
                                            
channelServerSecureChannelLayer 
_on_BrowseNextRequest
                    
                            - 
                                            
message - 
                                            
channel 
Parameters:
- 
                                            
messageObject - 
                                            
channelObject 
_on_BrowseRequest
                    
                            - 
                                            
message - 
                                            
channel 
Parameters:
- 
                                            
messageObject - 
                                            
channelObject 
_on_CloseSessionRequest
                    
                            - 
                                            
message - 
                                            
channel 
Parameters:
- 
                                            
messageObject - 
                                            
channelObject 
_on_FindServersRequest
                    
                            - 
                                            
message - 
                                            
channel 
Parameters:
- 
                                            
messageObject - 
                                            
channelObject 
_on_GetEndpointsRequest
                    
                            - 
                                            
message - 
                                            
channel 
Parameters:
- 
                                            
messageObject - 
                                            
channelObject 
bindMethod
                    
                            - 
                                            
nodeId - 
                                            
func 
Parameters:
- 
                                            
nodeIdNodeIdthe node id of the method - 
                                            
funcObject- 
                                                        
inputArgumentsArray - 
                                                        
contextObject - 
                                                        
callbackFunction- 
                                                                    
errError - 
                                                                    
callMethodResultCallMethodResult 
 - 
                                                                    
 
 - 
                                                        
 
browse
                    
                            - 
                                            
nodesToBrowse - 
                                            
[session] 
Parameters:
- 
                                            
nodesToBrowseBrowseDescription[] - 
                                            
[session]ServerSession optional 
Returns:
browseSingleNode
                    
                            - 
                                            
nodeId - 
                                            
browseDescription - 
                                            
[session] 
Parameters:
- 
                                            
nodeIdNodeId | String: the nodeid of the element to browse - 
                                            
browseDescriptionObject- 
                                                        
browseDirectionBrowseDirection:
 - 
                                                        
referenceTypeIdString | NodeId 
 - 
                                                        
 - 
                                            
[session]ServerSession optional 
Returns:
closeSession
                    
                            - 
                                            
authenticationToken - 
                                            
deleteSubscriptions - 
                                            
[reason = "CloseSession"] 
Parameters:
- 
                                            
authenticationTokenObject - 
                                            
deleteSubscriptionsBoolean: true if sessions's subscription shall be deleted - 
                                            
[reason = "CloseSession"]String optionalthe 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. 
getChannels
                    
                            ()
                    
                            
                                Arrayreturns a array of currently active channels
Returns:
getSession
                    
                            - 
                                            
authenticationToken - 
                                            
activeOnly 
retrieve a session by authentication token
Parameters:
- 
                                            
authenticationTokenObject - 
                                            
activeOnlyObjectsearch only within sessions that are not closed
 
historyRead
                    
                            - 
                                            
context - 
                                            
historyReadRequest - 
                                            
callback 
Parameters:
- 
                                            
contextSessionContext - 
                                            
historyReadRequestHistoryReadRequest- 
                                                        
requestHeaderRequestHeader - 
                                                        
historyReadDetailsHistoryReadDetails - 
                                                        
timestampsToReturnTimestampsToReturn - 
                                                        
releaseContinuationPointsBoolean - 
                                                        
nodesToReadHistoryReadValueId[] 
 - 
                                                        
 - 
                                            
callbackFunction- 
                                                        
err - 
                                                        
resultsHistoryReadResult[] 
 - 
                                                        
 
historyReadSingleNode
                    
                            - 
                                            
context - 
                                            
nodeId - 
                                            
attributeId - 
                                            
historyReadDetails - 
                                            
[timestampsToReturn=TimestampsToReturn.Neither] - 
                                            
callback 
Parameters:
- 
                                            
contextSessionContext - 
                                            
nodeIdNodeId - 
                                            
attributeIdAttributeId - 
                                            
historyReadDetailsHistoryReadDetails - 
                                            
[timestampsToReturn=TimestampsToReturn.Neither]Object optional - 
                                            
callbackFunction- 
                                                        
err - 
                                                        
resultsHistoryReadResult 
 - 
                                                        
 
initialize
                    
                            - 
                                            
done 
Initialize the server by installing default node set.
Parameters:
- 
                                            
doneFunction 
iterate_on_signed_message_chunks
                    
                            - 
                                            
buffer - 
                                            
callback 
Parameters:
- 
                                            
bufferObject - 
                                            
callbackFunction- 
                                                        
errError - 
                                                        
chunksArray 
 - 
                                                        
 
makeServiceFault
                    
                            - 
                                            
statusCode - 
                                            
messages 
construct a service Fault response
Parameters:
- 
                                            
statusCodeObject - 
                                            
messagesObject 
read
                    
                            - 
                                            
readRequest 
Parameters:
- 
                                            
readRequestReadRequest- 
                                                        
timestampsToReturnTimestampsToReturn - 
                                                        
nodesToRead - 
                                                        
maxAgeNumbermaxAge - 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
                    
                            - 
                                            
context - 
                                            
nodeId - 
                                            
attributeId - 
                                            
[timestampsToReturn=TimestampsToReturn.Neither] 
Parameters:
- 
                                            
contextSessionContext - 
                                            
nodeIdObject - 
                                            
attributeIdAttributeId - 
                                            
[timestampsToReturn=TimestampsToReturn.Neither]Object optional 
Returns:
refreshValues
                    
                            - 
                                            
nodesToRefresh - 
                                            
callback 
`asyncRefresh` on all variable nodes that provide an async refresh func.
                        Parameters:
- 
                                            
nodesToRefreshArrayan array containing the node to consider Each element of the array shall be of the form { nodeId:, attributeIds: }.  - 
                                            
callbackFunction- 
                                                        
errNull | Error - 
                                                        
dataArray: an array containing value read The array length matches the number of nodeIds that are candidate for an async refresh (i.e: nodes that are of type Variable with asyncRefresh func }
 
 - 
                                                        
 
registerServer
                    
                            - 
                                            
discoveryServerEndpointUrl - 
                                            
isOnline - 
                                            
outer_callback 
Parameters:
- 
                                            
discoveryServerEndpointUrlObject - 
                                            
isOnlineObject - 
                                            
outer_callbackObject 
registerShutdownTask
                    
                            ()
                    
                    
                    
                    
                    
                    
                    
                    
                        
                    
                        resumeEndPoints
                    
                            - 
                                            
callback 
set all the end point into a state where they do accept connections note: this method is useful for testing purpose
Parameters:
- 
                                            
callbackFunction 
secondsTillShutdown
                    
                            ()
                    
                            
                                UInt32
                            
                    
                    
                    
                    
                    
                    
                    
                        
                    
                        Returns:
shutdown
                    
                            - 
                                            
[timeout=0] - 
                                            
callback 
shutdown all server endpoints
Parameters:
- 
                                            
[timeout=0]Number optionalthe timeout before the server is actually shutdown
 - 
                                            
callbackCallback- 
                                                        
errError | Null 
 - 
                                                        
 
Example:
// shutdown immediately server.shutdown(function(err) { });
// shutdown within 10 seconds server.shutdown(10000,function(err) { });
start
                    
                            - 
                                            
done 
Initiate the server by starting all its endpoints
Parameters:
- 
                                            
doneFunction 
suspendEndPoints
                    
                            - 
                                            
callback 
set all the end point into a state where they do not accept further connections
note: this method is useful for testing purpose
Parameters:
- 
                                            
callbackFunction 
transferSubscription
                    
                            - 
                                            
session - 
                                            
subscriptionId - 
                                            
sendInitialValues 
Parameters:
- 
                                            
sessionServerSession- the new session that will own the subscription - 
                                            
subscriptionIdIntegerId- the subscription Id to transfer - 
                                            
sendInitialValuesBoolean- true if initial values will be resent. 
Returns:
userNameIdentityTokenAuthenticateUser
                    
                            - 
                                            
channel - 
                                            
session - 
                                            
userTokenPolicy - 
                                            
userIdentityToken - 
                                            
done 
Parameters:
- 
                                            
channelObject - 
                                            
sessionObject - 
                                            
userTokenPolicyObject - 
                                            
userIdentityTokenObject - 
                                            
doneFunction- 
                                                        
errError - 
                                                        
isAuthorizedBoolean 
 - 
                                                        
 
Returns:
write
                    
                            - 
                                            
context - 
                                            
nodesToWrite - 
                                            
callback 
Parameters:
- 
                                            
contextObject - 
                                            
nodesToWriteObject - 
                                            
callbackFunction- 
                                                        
err - 
                                                        
resultsStatusCode[] 
 - 
                                                        
 
writeSingleNode
                    
                            - 
                                            
context - 
                                            
writeValue - 
                                            
callback 
Parameters:
- 
                                            
contextContext - 
                                            
writeValueDataValue - 
                                            
callbackFunction- 
                                                        
errError | Null - 
                                                        
statusCodeStatusCode 
 - 
                                                        
 
Properties
allowAnonymous
                        Boolean
                    
                    
                    
                    
                    
                        
                    
                        bytesRead
                        Number
                    
                    
                    
                    
                    
                        
                    
                        total number of bytes read by the server since startup
bytesWritten
                        Number
                    
                    
                    
                    
                    
                        
                    
                        total number of bytes written by the server since startup
cumulatedSessionCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        cumulatedSubscriptionCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        currentChannelCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        the number of connected channel on all existing end points
currentSessionCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        the number of sessions currently active
currentSubscriptionCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        The number of active subscriptions from all sessions
initialized
                        Boolean
                    
                    
                    
                    
                    
                        
                    
                        true if the server has been initialized
maxAllowedSessionNumber
                        Number
                    
                    
                    
                    
                    
                        
                    
                        maxConnectionsPerEndpoint
                        Number
                    
                    
                    
                    
                    
                        
                    
                        publishingIntervalCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        rejectedSessionCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        rejectedSessionCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        serverName
                        String
                    
                    
                    
                    
                    
                        
                    
                        serverNamespaceName
                        String
                    
                    
                    
                    
                    
                        
                    
                        serverNameUrn
                        String
                    
                    
                    
                    
                    
                        
                    
                        serverType
                        ApplicationType
                    
                    
                    
                    
                    
                        
                    
                        The type of server : SERVER, CLIENTANDSERVER, DISCOVERYSERVER
sessionAbortCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        transactionsCount
                        Number
                    
                    
                    
                    
                    
                        
                    
                        Number of transactions processed by the server since startup
Events
serverRegistered
                        
                    
                    
                    
                    
                    
                        
                    
                        emitted when the server is successfully registered to the LDS
serverRegistrationPending
                        
                    
                    
                    
                    
                    
                        
                    
                        emitted when the server is trying to registered the LDS but when the connection to the lds has failed serverRegistrationPending is sent when the backoff signal of the connection process is raised
serverRegistrationRenewed
                        
                    
                    
                    
                    
                    
                        
                    
                        emitted when the server has successfully renewed its registration to the LDS
serverUnregistered
                        
                    
                    
                    
                    
                    
                        
                    
                        emitted when the server is successfully unregistered to the LDS ( for instance during shutdown)
            The NodeOPCUA API