Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ClientSession

Hierarchy

  • EventEmitter
  • IBasicSession
    • ClientSession

Implemented by

Index

Properties

Optional authenticationToken

authenticationToken: NodeId

endpoint

endpoint: EndpointDescription

isReconnecting

isReconnecting: boolean

lastRequestSentTime

lastRequestSentTime: Date

the time of the latest request sent by the client to the server

lastResponseReceivedTime

lastResponseReceivedTime: Date

the time of the latest response received by the client

name

name: string

the session name

requestedMaxReferencesPerNode

requestedMaxReferencesPerNode: number

the maximum number of reference that the server should return per browseResult Continuous points will be return by server to allow retrieving remaining references with browseNext

serverCertificate

serverCertificate: Certificate

the server certificate as provided by the server

sessionId

sessionId: NodeId

subscriptionCount

subscriptionCount: number

timeout

timeout: number

the session Id

Static defaultMaxListeners

defaultMaxListeners: number

Methods

acknowledgeCondition

  • helper to acknowledge a condition

    from Spec 1.03 Part 9 : page 27

    The Acknowledge Method is used to acknowledge an Event Notification for a Condition instance state where AckedState 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 Acknowledge Method by specifying ConditionId as the ObjectId.

    The Method cannot be called with an ObjectId of the AcknowledgeableConditionType Node.

    A Condition instance may be an Object that appears in the Server Address Space. If this is the case the ConditionId is the NodeId for the Object.

    The EventId identifies a specific Event Notification where a state to be acknowledged was reported.

    Acknowledgement and the optional comment will be applied to the state identified with the EventId. If the comment field is NULL (both locale and text are empty) it will be ignored and any existing comments will remain unchanged. If the comment is to be reset, an empty text with a locale shall be provided.

    A valid EventId will result in an Event Notification where AckedState/Id is set to TRUE and the Comment Property contains the text of the optional comment argument. If a previous state is acknowledged, the BranchId and all Condition values of this branch will be reported.

    Parameters

    Returns void

  • Parameters

    Returns Promise<void>

addCommentCondition

  • helper to add a comment to a condition

    The AddComment Method is used to apply a comment to a specific state of a Condition instance.

    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 AddComment Method by specifying ConditionId as the ObjectId.

    The Method cannot be called with an ObjectId of the ConditionType Node.

    Notes:

    • Comments are added to Event occurrences identified via an EventId. EventIds where the related EventType is not a ConditionType (or subtype of it) and thus does not support Comments are rejected.
    • A ConditionEvent – where the Comment Variable contains this text – will be sent for the identified state. If a comment is added to a previous state (i.e. a state for which the Server has created a branch), the BranchId and all Condition values of this branch will be reported/.

    Parameters

    Returns void

  • Parameters

    Returns Promise<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

browse

browseNext

  • browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult>): void
  • browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult[]>): void
  • browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean): Promise<BrowseResult>
  • browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean): Promise<BrowseResult[]>

call

  • call(methodToCall: CallMethodRequestLike, callback: function): void
  • call(methodsToCall: CallMethodRequestLike[], callback: function): void
  • call(methodToCall: CallMethodRequestLike): Promise<CallMethodResult>
  • call(methodsToCall: CallMethodRequestLike[]): Promise<CallMethodResult[]>
  • call(methodToCall: CallMethodRequestLike, callback: function): void
  • call(methodsToCall: CallMethodRequestLike[], callback: function): void
  • call(methodToCall: CallMethodRequestLike): Promise<CallMethodResult>
  • call(methodsToCall: CallMethodRequestLike[]): Promise<CallMethodResult[]>
  • Parameters

    • methodToCall: CallMethodRequestLike
    • callback: function
        • (err: Error | null, result?: CallMethodResult): void
        • Parameters

          • err: Error | null
          • Optional result: CallMethodResult

          Returns void

    Returns void

  • Parameters

    • methodsToCall: CallMethodRequestLike[]
    • callback: function
        • (err: Error | null, results?: CallMethodResult[]): void
        • Parameters

          • err: Error | null
          • Optional results: CallMethodResult[]

          Returns void

    Returns void

  • Parameters

    • methodToCall: CallMethodRequestLike

    Returns Promise<CallMethodResult>

  • Parameters

    • methodsToCall: CallMethodRequestLike[]

    Returns Promise<CallMethodResult[]>

  • method

    call

    example

    :

    const methodToCall = {
        objectId: "ns=2;i=12",
        methodId: "ns=2;i=13",
        inputArguments: [
            new Variant({...}),
            new Variant({...}),
        ]
    }
    session.call(methodToCall,function(err,callResult) {
       if (!err) {
            console.log(" statusCode = ",callResult.statusCode);
            console.log(" inputArgumentResults[0] = ",callResult.inputArgumentResults[0].toString());
            console.log(" inputArgumentResults[1] = ",callResult.inputArgumentResults[1].toString());
            console.log(" outputArgument[0]       = ",callResult.outputArgument[0].toString()); // array of variant
       }
    });
    method

    call

    example

    :

    const methodsToCall = [ {
        objectId: "ns=2;i=12",
        methodId: "ns=2;i=13",
        inputArguments: [
            new Variant({...}),
            new Variant({...}),
        ]
    }];
    session.call(methodsToCall,function(err,callResutls) {
       if (!err) {
            const callResult = callResutls[0];
            console.log(" statusCode = ",rep.statusCode);
            console.log(" inputArgumentResults[0] = ",callResult.inputArgumentResults[0].toString());
            console.log(" inputArgumentResults[1] = ",callResult.inputArgumentResults[1].toString());
            console.log(" outputArgument[0]       = ",callResult.outputArgument[0].toString()); // array of variant
       }
    });

    Parameters

    • methodToCall: CallMethodRequestLike

      the call method request

    • callback: function
        • (err: Error | null, result?: CallMethodResult): void
        • Parameters

          • err: Error | null
          • Optional result: CallMethodResult

          Returns void

    Returns void

  • Parameters

    • methodsToCall: CallMethodRequestLike[]
    • callback: function
        • (err: Error | null, results?: CallMethodResult[]): void
        • Parameters

          • err: Error | null
          • Optional results: CallMethodResult[]

          Returns void

    Returns void

  • Parameters

    • methodToCall: CallMethodRequestLike

    Returns Promise<CallMethodResult>

  • Parameters

    • methodsToCall: CallMethodRequestLike[]

    Returns Promise<CallMethodResult[]>

close

  • close(callback: ErrorCallback): void
  • close(deleteSubscription: boolean, callback: ErrorCallback): void
  • close(deleteSubscription?: boolean): Promise<void>

confirmCondition

  • helper to confirm a condition

    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.

    Parameters

    • conditionId: NodeIdLike
    • eventId: Buffer
    • comment: LocalizedTextLike
    • callback: function
        • (err?: Error): void
        • Parameters

          • Optional err: Error

          Returns void

    Returns void

  • Parameters

    Returns Promise<void>

constructExtensionObject

  • constructExtensionObject(dataType: NodeId, pojo: any): Promise<ExtensionObject>

createMonitoredItems

createSubscription

createSubscription2

deleteSubscriptions

disableCondition

  • disableCondition(): void

emit

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

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

    Returns boolean

enableCondition

  • enableCondition(): void

eventNames

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

extractNamespaceDataType

  • extractNamespaceDataType(): Promise<ExtraDataTypeManager>

findMethodId

getArgumentDefinition

  • getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>
  • getArgumentDefinition(methodId: MethodId, callback: function): void
  • getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>
  • getArgumentDefinition(methodId: MethodId, callback: function): void
  • Parameters

    • methodId: MethodId

    Returns Promise<ArgumentDefinition>

  • Parameters

    • methodId: MethodId
    • callback: function
        • (err: Error | null, args?: ArgumentDefinition): void
        • Parameters

          • err: Error | null
          • Optional args: ArgumentDefinition

          Returns void

    Returns void

  • Parameters

    • methodId: MethodId

    Returns Promise<ArgumentDefinition>

  • Parameters

    • methodId: MethodId
    • callback: function
        • (err: Error | null, args?: ArgumentDefinition): void
        • Parameters

          • err: Error | null
          • Optional args: ArgumentDefinition

          Returns void

    Returns void

getBuiltInDataType

  • getBuiltInDataType(nodeId: NodeId): Promise<DataType>
  • getBuiltInDataType(nodeId: NodeId, callback: function): void
  • retrieve the built-in DataType of a Variable, from its DataType attribute.

    this method is useful to determine which DataType to use when constructing a Variant

    async
    example
    const session = ...; // ClientSession
    const nodeId = opcua.VariableIds.Server_ServerStatus_CurrentTime;
    session.getBuildInDataType(nodeId,function(err,dataType) {
      assert(dataType === opcua.DataType.DateTime);
    });
    // or
    nodeId = opcua.coerceNodeId("ns=2;s=Scalar_Static_ImagePNG");
    const dataType: await session.getBuildInDataType(nodeId);
    assert(dataType === opcua.DataType.ByteString);

    Parameters

    • nodeId: NodeId

      the node id of the variable to query

    Returns Promise<DataType>

  • Parameters

    • nodeId: NodeId
    • callback: function
        • (err: Error | null, dataType?: DataType): void
        • Parameters

          • err: Error | null
          • Optional dataType: DataType

          Returns void

    Returns void

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getMonitoredItems

getNamespaceIndex

  • getNamespaceIndex(namespaceUri: string): number

listenerCount

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

    • type: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

modifyMonitoredItems

modifySubscription

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: "keepalive", eventHandler: function): ClientSession
  • on(event: "keepalive_failure", eventHandler: function): ClientSession
  • on(event: "session_closed", eventHandler: function): ClientSession
  • on(event: string | symbol, listener: function): 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

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

queryFirst

rawListeners

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

    • event: string | symbol

    Returns Function[]

read

readHistoryValue

  • readHistoryValue(nodes: ReadValueIdOptions[], start: DateTime, end: DateTime, callback: function): void
  • readHistoryValue(nodes: ReadValueIdOptions[], start: DateTime, end: DateTime): Promise<HistoryReadResult[]>
  • readHistoryValue(node: ReadValueIdOptions, start: DateTime, end: DateTime, callback: function): void
  • readHistoryValue(nodes: ReadValueIdOptions, start: DateTime, end: DateTime): Promise<HistoryReadResult>

readNamespaceArray

  • readNamespaceArray(): Promise<string[]>
  • readNamespaceArray(callback: function): void

readVariableValue

registerNodes

  • registerNodes(nodesToRegister: NodeIdLike[]): Promise<NodeId[]>
  • registerNodes(nodesToRegister: NodeIdLike[], callback: function): void

removeAllListeners

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

    • Optional event: string | symbol

    Returns 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
  • Parameters

    • n: number

    Returns this

setMonitoringMode

transferSubscriptions

translateBrowsePath

  • translateBrowsePath(browsesPath: BrowsePath[], callback: ResponseCallback<BrowsePathResult[]>): void
  • translateBrowsePath(browsePath: BrowsePath, callback: ResponseCallback<BrowsePathResult>): void
  • translateBrowsePath(browsePath: BrowsePath): Promise<BrowsePathResult>
  • translateBrowsePath(browsePaths: BrowsePath[]): Promise<BrowsePathResult[]>
  • translateBrowsePath(browsesPath: BrowsePath[], callback: ResponseCallback<BrowsePathResult[]>): void
  • translateBrowsePath(browsePath: BrowsePath, callback: ResponseCallback<BrowsePathResult>): void
  • translateBrowsePath(browsePath: BrowsePath): Promise<BrowsePathResult>
  • translateBrowsePath(browsePaths: BrowsePath[]): Promise<BrowsePathResult[]>

unregisterNodes

  • unregisterNodes(nodesToRegister: NodeIdLike[]): Promise<void>
  • unregisterNodes(nodesToRegister: NodeIdLike[], callback: function): void

write

writeSingleNode

  • writeSingleNode(nodeToWrite: NodeIdLike, value: Variant): Promise<StatusCode>
  • writeSingleNode(nodeToWrite: NodeIdLike, value: Variant, callback: ResponseCallback<StatusCode>): void

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