Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ClientSubscription

Hierarchy

  • EventEmitter
    • ClientSubscription

Implemented by

Constructors

constructor

Events

on

  • on(event: string | symbol, listener: function): this
  • on(event: string | symbol, listener: function): this
  • on(event: "started", eventHandler: function): this
  • on(event: "terminated", eventHandler: function): this
  • on(event: "item_added", eventHandler: function): this
  • on(event: "keepalive", eventHandler: function): this
  • on(event: "internal_error", eventHandler: function): this
  • on(event: "raw_notification", eventHandler: function): this
  • on(event: "received_notifications", eventHandler: function): this
  • on(event: "status_changed", eventHandler: function): this
  • on(event: "error", eventHandler: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

  • notify the observers that the subscription has now started

    Parameters

    • event: "started"
    • eventHandler: function
        • (subscriptionId: number): void
        • Parameters

          • subscriptionId: number

          Returns void

    Returns this

  • notify the observers tha the client subscription has terminated

    Parameters

    • event: "terminated"
    • eventHandler: function
        • (): void
        • Returns void

    Returns this

  • notify the observers that a new monitored item has been added to the subscription.

    Parameters

    Returns this

  • notify the observers that a keep alive Publish Response has been received from the server.

    Parameters

    • event: "keepalive"
    • eventHandler: function
        • (): void
        • Returns void

    Returns this

  • notify the observers that an error has occurred

    Parameters

    • event: "internal_error"
    • eventHandler: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "raw_notification"
    • eventHandler: function
        • (notificationMessage: NotificationMessage): void
        • Parameters

          • notificationMessage: NotificationMessage

          Returns void

    Returns this

  • notify the observers that some notifications has been received from the server in a PublishResponse each modified monitored Item

    Parameters

    • event: "received_notifications"
    • eventHandler: function
        • (notificationMessage: NotificationMessage): void
        • Parameters

          • notificationMessage: NotificationMessage

          Returns void

    Returns this

  • notify the observers that the server has send a status changed notification (such as BadTimeout )

    Parameters

    • event: "status_changed"
    • eventHandler: function
        • (status: StatusCode, diagnosticInfo: DiagnosticInfo): void
        • Parameters

          • status: StatusCode
          • diagnosticInfo: DiagnosticInfo

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • eventHandler: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

Properties

hasSession

hasSession: boolean

return true if the subscription is attached to a valid session

isActive

isActive: boolean

true is the subscription is fully active

lifetimeCount

lifetimeCount: number

maxKeepAliveCount

maxKeepAliveCount: number

maxNotificationsPerPublish

maxNotificationsPerPublish: number

monitoredItems

priority

priority: number

publishingEnabled

publishingEnabled: boolean

publishingInterval

publishingInterval: number

session

session: ClientSession

return the session associated with the subscription. (may throw if the session is not valid)

subscriptionId

subscriptionId: SubscriptionId

timeoutHint

timeoutHint: number

Static defaultMaxListeners

defaultMaxListeners: number

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.

Methods

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

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>

getMaxListeners

  • getMaxListeners(): number

getMonitoredItems

  • getMonitoredItems(): Promise<MonitoredItemData>
  • getMonitoredItems(callback: function): void
  • Returns Promise<MonitoredItemData>

  • Parameters

    Returns void

listenerCount

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

    • event: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

monitor

  • monitor(itemToMonitor: ReadValueIdOptions, requestedParameters: MonitoringParametersOptions, timestampsToReturn: TimestampsToReturn): Promise<ClientMonitoredItem>
  • monitor(itemToMonitor: ReadValueIdOptions, requestedParameters: MonitoringParametersOptions, timestampsToReturn: TimestampsToReturn, done: function): void
  • add a monitor item to the subscription

    method

    monitor

    Monitoring a simple Value Change

    example:

    clientSubscription.monitor( // itemToMonitor: { nodeId: "ns=0;i=2258", attributeId: AttributeIds.Value, indexRange: null, dataEncoding: { namespaceIndex: 0, name: null } }, // requestedParameters: { samplingInterval: 3000, filter: null, queueSize: 1, discardOldest: true }, TimestampsToReturn.Neither );

    Monitoring a Value Change With a DataChange Filter

    options.trigger {DataChangeTrigger} {Status|StatusValue|StatusValueTimestamp} options.deadbandType {DeadbandType} {None|Absolute|Percent} options.deadbandValue {Double}

    example:

    clientSubscription.monitor( // itemToMonitor: { nodeId: "ns=0;i=2258", attributeId: AttributeIds.Value, }, // requestedParameters: { samplingInterval: 3000, filter: new DataChangeFilter({ trigger: DataChangeTrigger.StatusValue, deadbandType: DeadbandType.Absolute, deadbandValue: 0.1 }), queueSize: 1, discardOldest: true }, TimestampsToReturn.Neither );

    Monitoring an Event

    If the monitor attributeId is EventNotifier then the filter must be specified

    example:

    var filter = new EventFilter({ selectClauses: [ { browsePath: [ {name: 'ActiveState' }, {name: 'id'} ]}, { browsePath: [ {name: 'ConditionName'} ]} ], whereClause: [] });

    clientSubscription.monitor( // itemToMonitor: { nodeId: "ns=0;i=2258", attributeId: AttributeIds.EventNotifier, indexRange: null, dataEncoding: { namespaceIndex: 0, name: null } }, // requestedParameters: { samplingInterval: 3000,

       filter: filter,
    
       queueSize: 1,
       discardOldest: true
    },
    TimestampsToReturn.Neither

    );

    Parameters

    • itemToMonitor: ReadValueIdOptions
    • requestedParameters: MonitoringParametersOptions
    • timestampsToReturn: TimestampsToReturn

    Returns Promise<ClientMonitoredItem>

  • Parameters

    • itemToMonitor: ReadValueIdOptions
    • requestedParameters: MonitoringParametersOptions
    • timestampsToReturn: TimestampsToReturn
    • done: function

    Returns void

monitorItems

  • monitorItems(itemsToMonitor: ReadValueIdOptions[], requestedParameters: MonitoringParametersOptions, timestampsToReturn: TimestampsToReturn): Promise<ClientMonitoredItemGroup>
  • monitorItems(itemsToMonitor: ReadValueIdOptions[], requestedParameters: MonitoringParametersOptions, timestampsToReturn: TimestampsToReturn, done: function): void
  • method

    monitorItems

    async

    Parameters

    • itemsToMonitor: ReadValueIdOptions[]
    • requestedParameters: MonitoringParametersOptions
    • timestampsToReturn: TimestampsToReturn

    Returns Promise<ClientMonitoredItemGroup>

    a ClientMonitoredItemGroup

  • method

    monitorItems

    async

    Parameters

    Returns void

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

once

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

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

          • Rest ...args: any[]

          Returns void

    Returns 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

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

terminate

  • terminate(): Promise<void>
  • terminate(callback: ErrorCallback): void
  • Returns Promise<void>

  • Parameters

    Returns void

Static create

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