APIs

Show:

Constructor

OPCUAClient

(
  • options
)

Parameters:

  • options Object
    • [securityMode=MessageSecurityMode.None] MessageSecurityMode optional

      the default security mode.

    • [securityPolicy=SecurityPolicy.NONE] SecurityPolicy optional

      the security mode.

    • [requestedSessionTimeout= 60000] Number optional

      the requested session time out in CreateSession

    • [applicationName="NodeOPCUA-Client"] String optional

      the client application name

    • [endpoint_must_exist=true] Boolean optional

      set to false if the client should accept server endpoint mismatch

    • [keepSessionAlive=false] Boolean optional
    • [certificateFile="certificates/client_selfsigned_cert_1024.pem"] String optional

      client certificate pem file.

    • [privateKeyFile="certificates/client_key_1024.pem"] String optional

      client private key pem file.

    • [clientName=""] String optional

      a client name string that will be used to generate session names.

Item Index

Methods

Methods

closeSession

(
  • session
  • deleteSubscriptions
  • callback
)
async

Parameters:

  • session ClientSession
    • the created client session
  • deleteSubscriptions Boolean
    • whether to delete subscriptions or not
  • callback Function
    • the callback
    • err Error | Null
      • the Error if the async method has failed

confirmCondition from Spec 1.03 Part 9 : page 27 The Confirm Method is used to confirm an Event Notifications for a Condition instance state where ConfirmedState is FALSE. Normally, the NodeId of the object instance as the ObjectId is passed to the Call Service. However, some Servers do not expose Condition instances in the AddressSpace. Therefore all Servers shall also allow Clients to call the Confirm Method by specifying ConditionId as the ObjectId. The Method cannot be called with an ObjectId of the AcknowledgeableConditionType Node.

(
  • conditionId
  • eventId
  • comment
  • callback
)

Parameters:

  • conditionId Object
  • eventId Object
  • comment Object
  • callback Object

connect

(
  • endpoint_url
  • callback
)
async

connect the OPC-UA client to a server end point.

Parameters:

  • endpoint_url String
  • callback Function

createSession

(
  • [userIdentityInfo]
  • callback
)
async

create and activate a new session

Parameters:

  • [userIdentityInfo] Object optional

    optional

    • [userName] String optional
    • [password] String optional
  • callback Function
    • err Error | Null
      • the Error if the async method has failed
    • session ClientSession
      • the created session object.

Example:

:

// create a anonymous session
                    client.createSession(function(err) {
                      if (err) {} else {}
                    });
                    
                    // create a session with a userName and password
                    client.createSession({userName: "JoeDoe", password:"secret"}, function(err) {
                      if (err) {} else {}
                    });
                    

disconnect

(
  • callback
)
async

disconnect client from server

Parameters:

  • callback Object

    [Function}

findEndpoint

() EndPoint

return the endpoint information matching security mode and security policy.

Returns:

EndPoint:

findServers

(
  • callback
)
async

send a FindServers request to a discovery server

Parameters:

  • callback Object

    [Function}

getEndpointsRequest

(
  • [options]
  • [options.localeIds}
  • [options.profileUris}
  • callback
)
async

Parameters:

  • [options] Object optional
    • [endpointUrl] String optional

      the network address that the Client used to access the Discovery Endpoint .

  • [options.localeIds} Array

    List of locales to use.

  • [options.profileUris} Array

    List of transport profiles that the returned Endpoints shall support.

  • callback Function
    • err Error | Null
    • serverEndpoints Array

      the array of endpoint descriptions

perform_findServersRequest

(
  • discovery_server_endpointUrl
  • callback
)
async

extract the server endpoints exposed by a discovery server

Parameters:

  • discovery_server_endpointUrl Object
  • callback Object

reactivateSession

(
  • session
  • callback
)

transfer session to this client

Parameters:

  • session Object
  • callback Object

Returns:

:

readUAAnalogItem

(
  • session
  • nodeId
  • callback
)

Parameters:

  • session Object
  • nodeId Object
  • callback Object

withSession

(
  • inner_func
  • callback
)

Parameters:

  • inner_func Function
  • callback Function

Properties

bytesRead

Number

total number of bytes read by the client

bytesWritten

Number

total number of bytes written by the client

connectionStrategy

options.connectionStrategy | MaxRetry, initialDelay, maxDelay, randomisationFactor | | MaxRetry: number, initialDelay: number, maxDelay: number, randomisationFactor: number

isReconnecting

Boolean true if the client is trying to reconnect to the server after a connection break.

keepSessionAlive

Boolean

true if session shall periodically probe the server to keep the session alive and prevent timeout

knowsServerEndpoint

Boolean

is true when the client has already requested the server end points.

reconnectOnFailure

Boolean

true if the connection strategy is set to automatically try to reconnect in case of failure

securityMode

MessageSecurityMode

serverCertificate

Certificate

transactionsPerformed

Number

total number of transactions performed by the client

Events

after_reconnection

notify the observers that the reconnection process has been completed

Event Payload:

  • err Object

close

Event Payload:

  • error Error

connection_reestablished send when the connection is reestablished after a connection break

receive_chunk

notify the observer that a message_chunk has been received

Event Payload:

  • message_chunk Object

receive_response

notify the observer that a response has been received from the server.

Event Payload:

  • message Object

send_chunk

notify the observer that a message_chunk has been sent

Event Payload:

  • message_chunk Object

send_request

notify the observer that a request has been sent to the server.

Event Payload:

  • message Object

start_reconnection

notifies the observer that the OPCUA is now trying to reestablish the connection after having received a connection break...

timed_out_request

send when a request has timed out without receiving a response

Event Payload:

  • request Object