/** * @module opcua.client */ import { EventEmitter } from '../eventemitter'; import { NodeId } from '../nodeid/nodeid'; import { OPCUAClientBase, ErrorCallback, ResponseCallback } from './client_base'; import type { UserIdentityInfo } from './opcua_client'; import { ICreateMonitoredItemsRequest } from '../generated/CreateMonitoredItemsRequest'; import { CreateMonitoredItemsResponse } from '../generated/CreateMonitoredItemsResponse'; import { ICreateSubscriptionRequest } from '../generated/CreateSubscriptionRequest'; import { CreateSubscriptionResponse } from '../generated/CreateSubscriptionResponse'; import { PublishResponse } from '../generated/PublishResponse'; import { IPublishRequest } from '../generated/PublishRequest'; import { IRepublishRequest } from '../generated/RepublishRequest'; import { RepublishResponse } from '../generated/RepublishResponse'; import { IDeleteMonitoredItemsRequest } from '../generated/DeleteMonitoredItemsRequest'; import { IModifyMonitoredItemsRequest } from '../generated/ModifyMonitoredItemsRequest'; import { ModifyMonitoredItemsResponse } from '../generated/ModifyMonitoredItemsResponse'; import { IDeleteSubscriptionsRequest } from '../generated/DeleteSubscriptionsRequest'; import { ITransferSubscriptionsRequest } from '../generated/TransferSubscriptionsRequest'; import { ClientSidePublishEngine } from './client_publish_engine'; import type { ClientSubscription } from './ClientSubscription'; import { ClientSessionKeepAliveManager } from './client_session_keepalive_manager'; import { UInt32, StatusCode } from '../basic-types'; import { CallMethodRequest } from '../generated/CallMethodRequest'; import { CallMethodResult } from '../generated/CallMethodResult'; import { Argument } from '../generated/Argument'; import { DataType } from '../variant/DataTypeEnum'; import { DataValue } from '../data-value'; import { Variant } from '../variant'; import * as subscription_service from '../service-subscription'; import * as read_service from '../service-read'; import * as historizing_service from '../service-history'; import * as browse_service from '../service-browse'; import * as write_service from '../service-write'; import * as query_service from '../service-query'; import * as translate_service from '../service-translate-browse-path'; import { DiagnosticInfo } from '../data-model'; import { BrowseDescription } from '../service-browse'; import { RequestHeader } from '../generated/RequestHeader'; import { IBrowseDescription } from '../generated/BrowseDescription'; import { TransferSubscriptionsResponse } from '../service-subscription'; import { IModifySubscriptionRequest, ISetMonitoringModeRequest, SignatureData, ServerState } from '../generated'; import { IEncodable } from '../factory/factories_baseobject'; export interface ClientSessionEvent { session_activated: () => void; session_closed: (status: StatusCode) => void; keepalive: (state: ServerState) => void; keepalive_failure: () => void; /** * raised when the session has been repaired after a reconnection: the secure * channel has been re-established, the session re-activated or re-created, and * its subscriptions transferred/republished. * * Notes: * - raised per session, as soon as that session has been repaired: if another * session of the same client fails to be repaired afterwards, the client is * disconnected and this session closed. * - subscriptions are repaired on a best-effort basis: a subscription that * could not be recreated or republished does not prevent this event. */ session_restored: () => void; } /** * @class ClientSession * @param client {OPCUAClient} * @constructor */ export declare class ClientSession extends EventEmitter { get client(): OPCUAClientBase | null; set client(cli: OPCUAClientBase | null); get closed(): boolean; set closed(closed: boolean); constructor(client: OPCUAClientBase); /** * the endpoint on which this session is operating * @property endpoint * @type {EndpointDescription} */ get endpoint(): any; get timeout(): number; set timeout(t: number); get subscriptionCount(): number; get isReconnecting(): boolean; protected static emptyUint32Array: Uint32Array; protected static readonly allAttributeIds: read_service.AttributeIds[]; /** * the user identity this session was last activated with. * * It has to be remembered: a Server rejects an ActivateSession that moves an * existing Session to a new SecureChannel while changing the UserTokenType * ("Activating a session on a new SecureChannel not allowed with different * UserTokenType"), so every re-activation has to replay the identity the * session was originally activated with. * * `undefined` means "never activated"; an anonymous session stores `null`. */ userIdentityInfo?: UserIdentityInfo | null; serverCertificate?: Uint8Array; serverNonce?: Uint8Array; serverSignature?: SignatureData; /** * ECC session ephemeral keys (Part 6 ยง6.8.2) by ECDHPolicyUri: the latest * server EphemeralKey received via AdditionalHeader, plus whether it was * already consumed by an EccEncryptedSecret (servers reject reuse). */ serverEccEphemeralKeys?: Record; authenticationToken?: NodeId; sessionId: any; name: any; protected _closeEventHasBeenEmmitted: boolean; protected _client: OPCUAClientBase | null; protected _publishEngine?: ClientSidePublishEngine; protected _closed: boolean; protected _requestedMaxReferencesPerNode: number; protected _keepAliveManager?: ClientSessionKeepAliveManager; protected lastRequestSentTime: number; protected _lastResponseReceivedTime: number; protected _timeout: number; protected _namespaceArray: string[] | undefined; get lastResponseReceivedTime(): number; static coerceBrowseDescription(data: string | NodeId | IBrowseDescription): BrowseDescription; /** * @method getPublishEngine * @return {ClientSidePublishEngine} */ getPublishEngine(): ClientSidePublishEngine; /** * browse a node or an array of nodes. * * @method browse * @async * * @example: * * form1: * * ``` javascript * session.browse("RootFolder",function(err,results,diagnostics) {} ); * ``` * * form2: * * ``` javascript * var browseDescription = { * nodeId: "ObjectsFolder", * referenceTypeId: "Organizes", * browseDirection: BrowseDirection.Inverse, * includeSubtypes: true, * nodeClassMask: 0, * resultMask: 63 * } * session.browse(browseDescription,function(err,browseResults,diagnostics) {} ); * ``` * * form3: * * ``` javascript * session.browse([ "RootFolder", "ObjectsFolder"],function(err,browseResults,diagnostics) { * assert(browseResults.length === 2); * }); * ``` * * form4: * * ``` javascript * var browseDescriptions = [ * { * nodeId: "ObjectsFolder", * referenceTypeId: "Organizes", * browseDirection: BrowseDirection.Inverse, * includeSubtypes: true, * nodeClassMask: 0, * resultMask: 63 * } * ] * session.browse(browseDescription,function(err,browseResults,diagnostics) {} ); * ``` * * @param nodeToBrowse {String|BrowseDescription|Array[BrowseDescription]} * @param callback {Function} * @param callback.err {Error|null} * @param callback.results {BrowseResult[]|BrowseResult} an array containing the BrowseResult of each BrowseDescription. * @param callback.diagnosticInfos {DiagnosticInfo} an array containing the BrowseResult of each BrowseDescription. */ browse(nodesToBrowse: string | string[] | NodeId | NodeId[] | IBrowseDescription | IBrowseDescription[], callback: ResponseCallback): void; browseP(nodesToBrowse: string | string[] | NodeId | NodeId[] | IBrowseDescription | IBrowseDescription[]): Promise<{ results: browse_service.BrowseResult[]; diagnosticInfos: DiagnosticInfo[] | browse_service.BrowseResponse; }>; /** * This Service is used to request the next set of Browse or BrowseNext * response information that is too large to be sent in a single response * @param continuationPoints A list of Server-defined opaque values that represent continuation points. * The value for a continuation point was returned to the Client in a previous Browse or BrowseNext response. * @param releaseContinuationPoints * TRUE passed continuationPoints shall be reset to free resources in the Server. * The continuation points are released and the results and diagnosticInfos arrays are empty. * FALSE passed continuationPoints shall be used to get the next set of browse information. * * After receiving the last browse results with browseNext the resources on * the server are freed automatically, no additional browseNext call with FALSE is necessary * @param callback */ browseNext(continuationPoints: Uint8Array | Uint8Array[], releaseContinuationPoints: boolean | undefined, callback: ResponseCallback): void; browseNextP(continuationPoints: Uint8Array | Uint8Array[], releaseContinuationPoints?: boolean): Promise<{ results: browse_service.BrowseResult[]; diagnosticInfos: DiagnosticInfo[] | browse_service.BrowseNextResponse; }>; /** * @method readVariableValue * @async * @example: * * session.readVariableValue("ns=2;s=Furnace_1.Temperature",function(err,dataValue,diagnostics) { * if(err) { return callback(err); } * if (dataValue.statusCode === opcua.StatusCodes.Good) { * } * console.log(dataValue.toString()); * callback(); * }); * * @param nodes {ReadValueId[]} - the read value id * @param {Function} callback - the callback function * @param callback.err {object|null} the error if write has failed or null if OK * @param callback.results {DataValue[]} - an array of dataValue each read * @param callback.diagnosticInfos {DiagnosticInfo[]} - the diagnostic info. * * * * @example * * - read a single node : * * session.readVariableValue("ns=0;i=2257",function(err,dataValue) { * if (!err) { * console.log(dataValue.toString()); * } * }); * * - read a array of nodes * session.readVariableValue(["ns=0;i=2257","ns=0;i=2258"],function(err,dataValues) { * if (!err) { * console.log(dataValues[0].toString()); * console.log(dataValues[1].toString()); * } * }); * * */ readVariableValue(nodes: string | NodeId | read_service.ReadValueId, callback: ResponseCallback): void; readVariableValue(nodes: string[] | NodeId[] | read_service.ReadValueId[], callback: ResponseCallback): void; readVariableValueP(nodes: string | NodeId | read_service.ReadValueId): Promise<{ value: DataValue; diagnosticInfos: DiagnosticInfo; }>; readVariableValueP(nodes: string[] | NodeId[] | read_service.ReadValueId[]): Promise<{ value: DataValue[]; diagnosticInfos: DiagnosticInfo[]; }>; /** * @method readHistoryValue * @async * * @param nodes {ReadValueId[]} - the read value id * @param start - the starttime in UTC format * @param end - the endtime in UTC format * @param {Function} callback - the callback function * @param callback.err {object|null} the error if write has failed or null if OK * @param callback.results {DataValue[]} - an array of dataValue each read * @param callback.diagnosticInfos {DiagnosticInfo[]} - the diagnostic infos. */ readHistoryValue(nodes: string[] | NodeId[] | historizing_service.HistoryReadValueId[], details: historizing_service.ReadRawModifiedDetails, callback: ResponseCallback): void; readHistoryValue(nodes: string[] | NodeId[] | historizing_service.HistoryReadValueId[], details: historizing_service.ReadProcessedDetails, callback: ResponseCallback): void; readHistoryValue(nodes: string[] | NodeId[] | historizing_service.HistoryReadValueId[], details: historizing_service.ReadEventDetails, callback: ResponseCallback): void; readHistoryValueP(nodes: string[] | NodeId[] | historizing_service.HistoryReadValueId[], details: historizing_service.ReadRawModifiedDetails): Promise<{ value: historizing_service.HistoryReadRawResult[] | historizing_service.HistoryReadModifiedResult[]; diagnosticInfos: DiagnosticInfo[]; }>; readHistoryValueP(nodes: string[] | NodeId[] | historizing_service.HistoryReadValueId[], details: historizing_service.ReadProcessedDetails): Promise<{ value: historizing_service.HistoryReadRawResult[]; diagnosticInfo: DiagnosticInfo[]; }>; readHistoryValueP(nodes: string[] | NodeId[] | historizing_service.HistoryReadValueId[], details: historizing_service.ReadEventDetails): Promise<{ value: historizing_service.HistoryReadEventResult[]; diagnosticInfo: DiagnosticInfo[]; }>; /** * @async * * @param nodes {ReadValueId[]} - the read value id * @parma details request details (note that isReadModified will be set to false) * @param {Function} callback - the callback function * @param callback.err {object|null} the error if write has failed or null if OK * @param callback.results {DataValue[]} - an array of dataValue each read * @param callback.diagnosticInfos {DiagnosticInfo[]} - the diagnostic infos. */ readHistoryRawValue(nodes: string | NodeId | read_service.ReadValueId, details: historizing_service.ReadRawModifiedDetails, callback: ResponseCallback): void; readHistoryRawValue(nodes: string[] | NodeId[] | read_service.ReadValueId[], details: historizing_service.ReadRawModifiedDetails, callback: ResponseCallback): void; readHistoryValueRawP(nodes: string | NodeId | read_service.ReadValueId, details: historizing_service.ReadRawModifiedDetails): Promise<{ value: historizing_service.HistoryReadResult; diagnosticInfos: DiagnosticInfo; }>; readHistoryValueRawP(nodes: string[] | NodeId[] | read_service.ReadValueId[], details: historizing_service.ReadRawModifiedDetails): Promise<{ value: historizing_service.HistoryReadResult[]; diagnosticInfos: DiagnosticInfo[]; }>; /** * @async * @method write * @param nodesToWrite {Array.} - the array of value to write. One or more elements. * * @param {Function} callback - the callback function * @param callback.err {object|null} the error if write has failed or null if OK * @param callback.statusCodes {StatusCode[]} - an array of status code of each write * @param callback.diagnosticInfos {DiagnosticInfo[]} - the diagnostic infos. * @async * * @example * * const nodesToWrite = [ * { * nodeId: "ns=1;s=SetPoint1", * attributeId: opcua.AttributeIds.Value, * value: { * statusCode: Good, * value: { * dataType: opcua.DataType.Double, * value: 100.0 * } * } * }, * { * nodeId: "ns=1;s=SetPoint2", * attributeId: opcua.AttributeIds.Value, * value: { * statusCode: Good, * value: { * dataType: opcua.DataType.Double, * value: 45.0 * } * } * } * ]; * session.write(nodesToWrite,function (err,statusCodes) { * if(err) { return callback(err);} * // * }); * * @method write * @param nodeToWrite {WriteValue} - the value to write * @param {Function} callback - the callback function * @param callback.err {object|null} the error if write has failed or null if OK * @param callback.statusCode {StatusCodes} - the status code of the write * @async * * @example * * const nodeToWrite = { * nodeId: "ns=1;s=SetPoint", * attributeId: opcua.AttributeIds.Value, * value: { * statusCode: Good, * value: { * dataType: opcua.DataType.Double, * value: 100.0 * } * } * }; * session.write(nodeToWrite,function (err,statusCode) { * if(err) { return callback(err);} * // * }); * * * @method write * @param nodeToWrite {WriteValue} - the value to write * @return Promise * @async * * @example * session.write(nodeToWrite).then(function(statusCode) { }); * * @example * const statusCode = await session.write(nodeToWrite); * * @method write * @param nodesToWrite {Array} - the value to write * @return Promise> * @async * * @example * session.write(nodesToWrite).then(function(statusCodes) { }); * * @example * const statusCodes = await session.write(nodesToWrite); */ write(nodesToWrite: write_service.WriteValue[], callback: ResponseCallback): void; write(nodesToWrite: write_service.WriteValue, callback: ResponseCallback): void; writeP(nodesToWrite: write_service.WriteValue): Promise; writeP(nodesToWrite: write_service.WriteValue[]): Promise; /** * * @async * @method writeSingleNode * @param nodeId {NodeId} - the node id of the node to write * @param value {Variant} - the value to write * @param callback {Function} * @param callback.err {object|null} the error if write has failed or null if OK * @param callback.statusCode {StatusCode} - the status code of the write * @param callback.diagnosticInfo {DiagnosticInfo} the diagnostic info. */ writeSingleNode(nodeId: NodeId, value: Variant, callback: (err: Error | null, sc?: StatusCode, di?: DiagnosticInfo) => void): void; writeSingleNodeP(nodeId: NodeId, value: Variant): Promise<{ status: StatusCode; diagnosticInfos?: DiagnosticInfo; }>; protected composeResult(nodes: NodeId[], nodesToRead: read_service.ReadValueId[], dataValues: DataValue[]): any[]; /** * @method readAllAttributes * * @example: * * ``` javascript * session.readAllAttributes("ns=2;s=Furnace_1.Temperature",function(err,data) { * if(!data.statusCode || data.statusCode === StatusCode.Good) { * console.log(" nodeId = ",data.nodeId.toString()); * console.log(" browseName = ",data.browseName.toString()); * console.log(" description = ",data.description.toString()); * console.log(" value = ",data.value.toString())); * * } * }); * ``` * * @async * @param nodes {NodeId|NodeId[]} - nodeId to read or an array of nodeId to read * @param callback {Function} - the callback function * @param callback.err {Error|null} - the error or null if the transaction was OK * @param callback.data {[]} a json object with the node attributes * @param callback.data.statusCode {StatusCodes} * @param callback.data.nodeId {NodeId} * @param callback.data. {*} * */ readAllAttributes(nodes: NodeId, callback: ResponseCallback): void; readAllAttributes(nodes: NodeId[], callback: ResponseCallback): void; readAllAttributesP(nodes: NodeId): Promise; readAllAttributesP(nodes: NodeId[]): Promise; /** * @method read * * @example: * * form1: reading many dataValue at once * * ``` javascript * var nodesToRead = [ * { * nodeId: "ns=2;s=Furnace_1.Temperature", * attributeId: AttributeIds.BrowseName * } * ]; * session.read(nodesToRead,function(err,dataValues,diagnosticInfos) { * if (!err) { * dataValues.forEach(dataValue=>console.log(dataValue.toString())); * } * }); * ``` * * form2: reading a single node * * ``` javascript * var nodeToRead = { * nodeId: "ns=2;s=Furnace_1.Temperature", * attributeId: AttributeIds.BrowseName * }; * * session.read(nodeToRead,function(err,dataValue,diagnosticInfos) { * if (!err) { * console.log(dataValue.toString()); * } * }); * ``` * * @async * * @param nodesToRead {ReadValueId|ReadValueId[]} - an array of nodeId to read or a ReadValueId * @param nodesToRead.nodeId {NodeId|string} * @param nodesToRead.attributeId {AttributeIds (number)} * @param [maxAge] {Number} * @param callback {Function} - the callback function * @param callback.err {Error|null} - the error or null if the transaction was OK} * @param callback.results {DataValue|DataValue[]} * @param callback.diagnosticInfos {DiagnosticInfo[]} * */ read(nodesToRead: read_service.ReadValueId, maxAge: number, callback: ResponseCallback): void; read(nodesToRead: read_service.ReadValueId[], maxAge: number, callback: ResponseCallback): void; readP(nodesToRead: read_service.ReadValueId, maxAge?: number): Promise<{ value: DataValue; diagnosticInfo: DiagnosticInfo; }>; readP(nodesToRead: read_service.ReadValueId[], maxAge?: number): Promise<{ value: DataValue[]; diagnosticInfo: DiagnosticInfo[]; }>; emitCloseEvent(statusCode?: StatusCode): void; protected _defaultRequest(SomeRequest: new (options: any) => any, SomeResponse: new () => T, options: any, callback: ResponseCallback): void; /** * @method createSubscription * @async * * @example: * * ``` javascript * session.createSubscription(request,function(err,response) {} ); * ``` * * @param options {CreateSubscriptionRequest} * @param options.requestedPublishingInterval {Duration} * @param options.requestedLifetimeCount {Counter} * @param options.requestedMaxKeepAliveCount {Counter} * @param options.maxNotificationsPerPublish {Counter} * @param options.publishingEnabled {Boolean} * @param options.priority {Byte} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {CreateSubscriptionResponse} - the response */ createSubscription(options: ICreateSubscriptionRequest, callback: (err: Error | null, response: CreateSubscriptionResponse) => void): void; createSubscriptionP(options: ICreateSubscriptionRequest): Promise; /** * @method deleteSubscriptions * @async * @example: * * session.deleteSubscriptions(request,function(err,response) {} ); * * @param options {DeleteSubscriptionsRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {DeleteSubscriptionsResponse} - the response */ deleteSubscriptions(options: IDeleteSubscriptionsRequest, callback: ResponseCallback): void; deleteSubscriptionsP(options: IDeleteSubscriptionsRequest): Promise; /** * @method transferSubscriptions * * @async * @param options {TransferSubscriptionsRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {TransferSubscriptionsResponse} - the response */ transferSubscriptions(options: ITransferSubscriptionsRequest, callback: ResponseCallback): void; transferSubscriptionsP(options: ITransferSubscriptionsRequest): Promise; /** * * @method createMonitoredItems * @async * @param options {CreateMonitoredItemsRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {CreateMonitoredItemsResponse} - the response */ createMonitoredItems(options: ICreateMonitoredItemsRequest, callback: ResponseCallback): void; createMonitoredItemsP(options: ICreateMonitoredItemsRequest): Promise; /** * * @method modifyMonitoredItems * @async * @param options {ModifyMonitoredItemsRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {ModifyMonitoredItemsResponse} - the response */ modifyMonitoredItems(options: IModifyMonitoredItemsRequest, callback: ResponseCallback): void; modifyMonitoredItemsP(options: IModifyMonitoredItemsRequest): Promise; /** * * @method modifySubscription * @async * @param options {ModifySubscriptionRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {ModifySubscriptionResponse} - the response */ modifySubscription(options: IModifySubscriptionRequest, callback: ResponseCallback): void; modifySubscriptionP(options: IModifySubscriptionRequest): Promise; setMonitoringMode(options: ISetMonitoringModeRequest, callback: ResponseCallback): void; setMonitoringModeP(options: ISetMonitoringModeRequest): Promise; /** * * @method publish * @async * @param options {PublishRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {PublishResponse} - the response */ publish(options: IPublishRequest, callback: ResponseCallback): void; publishP(options: IPublishRequest): Promise; /** * * @method republish * @async * @param options {RepublishRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed * @param callback.response {RepublishResponse} - the response */ republish(options: IRepublishRequest, callback: ResponseCallback): void; republishP(options: IRepublishRequest): Promise; /** * * @method deleteMonitoredItems * @async * @param options {DeleteMonitoredItemsRequest} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed */ deleteMonitoredItems(options: IDeleteMonitoredItemsRequest, callback: (err: Error | null) => void): void; /** * Returns the active subscription of this session with the given id, if any. */ protected _findSubscription(subscriptionId: number | undefined): ClientSubscription | undefined; /** * Sends the DeleteMonitoredItems request without touching any client-side state. * @internal used by {@link ClientSubscription}, which owns the client-side cleanup. */ _deleteMonitoredItemsOnServer(options: IDeleteMonitoredItemsRequest, callback: (err: Error | null) => void): void; deleteMonitoredItemsP(options: IDeleteMonitoredItemsRequest): Promise; /** * * @method setPublishingMode * @async * @param publishingEnabled {Boolean} * @param subscriptionIds {Array} * @param callback {Function} * @param callback.err {Error|null} - the Error if the async method has failed */ setPublishingMode(publishingEnabled: boolean, subscriptionIds: number[] | number, callback: ResponseCallback): void; setPublishingModeP(publishingEnabled: boolean, subscriptionIds: number[] | number): Promise; /** * * @method translateBrowsePath * @async * @param browsePath {BrowsePath|Array} * @param callback {Function} * @param callback.err {Error|null} * @param callback.response {BrowsePathResult|Array} * * * */ translateBrowsePath(browsePath: translate_service.BrowsePath[], callback: ResponseCallback): void; translateBrowsePath(browsePath: translate_service.BrowsePath, callback: ResponseCallback): void; translateBrowsePathP(browsePath: translate_service.BrowsePath[]): Promise; translateBrowsePathP(browsePath: translate_service.BrowsePath): Promise; isChannelValid(): boolean; performMessageTransaction(request: IEncodable & { requestHeader: RequestHeader; }, callback: ResponseCallback): void; /** * evaluate the time in milliseconds that the session will live * on the server end from now. The remaining live time is * calculated based on when the last message was sent to the server * and the session timeout. * * In normal operation , when server and client communicates on a regular * basis, evaluateRemainingLifetime will return a number slightly below * session.timeout * * when the client and server cannot communicate due to a network issue * (or a server crash), evaluateRemainingLifetime returns the estimated number * of milliseconds before the server (if not crash) will keep the session alive * on its end to allow a automatic reconnection with session. * * When evaluateRemainingLifetime returns zero , this mean that * the session has probably ended on the server side and will have to be recreated * from scratch in case of a reconnection. * @return {number} */ evaluateRemainingLifetime(): number; protected _terminatePublishEngine(): void; /** * * @method close * @async * @param [deleteSubscription=true] {Boolean} * @param callback {Function} */ close(deleteSubscription: boolean | undefined, callback: ErrorCallback): void; closeP(deleteSubscription?: boolean): Promise; /** * * @returns {Boolean} */ hasBeenClosed(): boolean; /** * * @method call * * @param methodsToCall {CallMethodRequest[]} the call method request array * @param callback {Function} * @param callback.err {Error|null} * @param callback.response {CallMethodResult[]} * * * @example : * * var methodsToCall = [ { * objectId: "ns=2;i=12", * methodId: "ns=2;i=13", * inputArguments: [ * new Variant({...}), * new Variant({...}), * ] * }]; * session.call(methodsToCall,function(err,response) { * if (!err) { * var rep = response[0]; * console.log(" statusCode = ",rep.statusCode); * console.log(" inputArgumentResults[0] = ",rep.inputArgumentResults[0].toString()); * console.log(" inputArgumentResults[1] = ",rep.inputArgumentResults[1].toString()); * console.log(" outputArgument[0] = ",rep.outputArgument[0].toString()); // array of variant * } * }); */ call(methodsToCall: CallMethodRequest[], callback: (err: Error | null, response?: CallMethodResult[], diagnosticInfo?: any) => void): void; callP(methodsToCall: CallMethodRequest[]): Promise<{ result: CallMethodResult[]; diagnosticInfo?: any; }>; /** * @method getMonitoredItems * @param subscriptionId {UInt32} the subscription Id to return * @param callback {Function} * @param callback.err {Error} * @param callback.monitoredItems the monitored Items * @param callback.monitoredItems the monitored Items */ getMonitoredItems(subscriptionId: UInt32, callback: { (err: Error, response?: CallMethodResult[], diag?: DiagnosticInfo): void; (err: null, response: { serverHandles: Uint32Array; clientHandles: Uint32Array; }, diag: DiagnosticInfo[]): void; }): void; /** * extract the argument definition of a method * @method getArgumentDefinition * @param methodId {NodeId} * @param callback {Function} * @param {Error|null} callback.err * @param {Argument<>} callback.inputArguments * @param {Argument<>} callback.outputArguments */ getArgumentDefinition(methodId: NodeId, callback: (err: Error | null, inputArguments?: Argument[], outputarguments?: Argument[]) => void): void; registerNodes(nodesToRegister: NodeId[] | string[], callback: ResponseCallback): void; registerNodesP(nodesToRegister: NodeId[] | string[]): Promise; unregisterNodes(nodesToUnregister: NodeId[] | string[], callback: ErrorCallback): void; unregisterNodesP(nodesToRegister: NodeId[] | string[]): Promise; /** * @method queryFirst * @param queryFirstRequest {queryFirstRequest} * @param callback {Function} * @param callback.err {Error|null} * @param callback.response {queryFirstResponse} * */ queryFirst(queryFirstRequest: query_service.IQueryFirstRequest, callback: ResponseCallback): void; queryFirstP(queryFirstRequest: query_service.IQueryFirstRequest): Promise; startKeepAliveManager(): void; stopKeepAliveManager(): void; dispose(): void; toString(): string; /** * retrieve the built-in DataType of a Variable, from its DataType attribute * useful to determine which DataType to use when constructing a Variant * @param nodeId {NodeId} the node id of the variable to query * @param callback {Function} the callback function * @param callback.err * @param callback.result {DataType} * @async * * * @example * var session = ...; // ClientSession * var 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"); * session.getBuildInDataType(nodeId,function(err,dataType) { * assert(dataType === opcua.DataType.ByteString); * }); * */ getBuiltInDataType(nodeId: NodeId, callback: (err: Error | null, result?: DataType) => void): void; getBuiltInDataTypeP(nodeId: NodeId): Promise; resumePublishEngine(): void; /** * * @param callback [Function} * @param callback.err {null|Error} * @param callback.namespaceArray {Array} */ readNamespaceArray(callback: ResponseCallback): void; readNamespaceArrayP(): Promise; getNamespaceIndex(namespaceUri: string): number; /** * returns the namespace index or undefined if not present * throws an error if * @param index default: 0 */ getNamespaceUri(index?: number): string; } //# sourceMappingURL=client_session.d.ts.map