Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ClientSecureChannelLayer

a ClientSecureChannelLayer represents the client side of the OPCUA secure channel.

Hierarchy

  • EventEmitter
    • ClientSecureChannelLayer

Constructors

constructor

Properties

channelId

channelId: number

endpointUrl

endpointUrl: string

protocolVersion

protocolVersion: number

Readonly securityMode

securityMode: MessageSecurityMode

Readonly securityPolicy

securityPolicy: SecurityPolicy

Static defaultMaxListeners

defaultMaxListeners: number

Static defaultTransactionTimeout

defaultTransactionTimeout: number = 60 * 1000

Static defaultTransportTimeout

defaultTransportTimeout: number = 60 * 1000

Static Readonly errorMonitor

errorMonitor: unique symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Static minTransactionTimeout

minTransactionTimeout: number = 10 * 1000

Accessors

bytesRead

  • get bytesRead(): number
  • Returns number

bytesWritten

  • get bytesWritten(): number
  • Returns number

isConnecting

  • get isConnecting(): boolean
  • true if the secure channel is trying to establish the connection with the server. In this case, the client may be in the middle of the backoff connection process.

    Returns boolean

timedOutRequestCount

  • get timedOutRequestCount(): number
  • Returns number

transactionsPerformed

  • get transactionsPerformed(): number
  • Returns number

Methods

abortConnection

  • Parameters

    Returns void

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

cancelPendingTransactions

  • Parameters

    Returns void

close

  • Close a client SecureChannel ,by sending a CloseSecureChannelRequest to the server.

    After this call, the connection is closed and no further transaction can be made.

    method

    close

    async

    Parameters

    Returns void

closeWithError

  • Parameters

    Returns void

create

  • establish a secure channel with the provided server end point.

    method

    create

    async
    example
    
    var secureChannel  = new ClientSecureChannelLayer({});
    
    secureChannel.on("end", function(err) {
         console.log("secure channel has ended",err);
         if(err) {
            console.log(" the connection was closed by an external cause such as server shutdown");
        }
    });
    secureChannel.create("opc.tcp://localhost:1234/UA/Sample", (err) => {
         if(err) {
              console.log(" cannot establish secure channel" , err);
         } else {
              console.log("secure channel has been established");
         }
    });
    

    Parameters

    • endpointUrl: string
    • callback: ErrorCallback

      the async callback function

    Returns void

dispose

  • dispose(): void
  • Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getCertificateChain

  • Returns Certificate | null

getClientNonce

  • getClientNonce(): Buffer
  • Returns Buffer

getDisplayName

  • getDisplayName(): string
  • Returns string

getMaxListeners

  • getMaxListeners(): number

getPrivateKey

  • getPrivateKey(): PrivateKeyPEM | null
  • Returns PrivateKeyPEM | null

isOpened

  • isOpened(): boolean
  • Returns boolean

isTransactionInProgress

  • isTransactionInProgress(): boolean
  • Returns boolean

isValid

  • isValid(): boolean
  • Returns boolean

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

performMessageTransaction

  • perform a OPC-UA message transaction, asynchronously. During a transaction, the client sends a request to the server. The provided callback will be invoked at a later stage with the reply from the server, or the error.

    preconditions:

    • the channel must be opened
    example
    let secure_channel ; // get a  ClientSecureChannelLayer somehow
    
    const request = new BrowseRequest({...});
    secure_channel.performMessageTransaction(request, (err,response) => {
       if (err) {
         // an error has occurred
       } else {
          assert(response instanceof BrowseResponse);
         // do something with response.
       }
    });

    Parameters

    Returns void

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this

toString

  • toString(): string
  • Returns string

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc