node-opcua-client 2.72.2 → 2.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client_base.d.ts +23 -40
- package/dist/client_base.js +1 -0
- package/dist/client_base.js.map +1 -1
- package/dist/client_session.d.ts +2 -2
- package/dist/client_session.js.map +1 -1
- package/dist/private/client_base_impl.d.ts +5 -17
- package/dist/private/client_base_impl.js +144 -131
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.js +10 -7
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/reconnection.js +57 -11
- package/dist/reconnection.js.map +1 -1
- package/dist/tools/findservers.js +2 -2
- package/dist/tools/findservers.js.map +1 -1
- package/package.json +34 -34
- package/source/client_base.ts +23 -40
- package/source/client_session.ts +4 -2
- package/source/private/client_base_impl.ts +181 -150
- package/source/private/client_session_impl.ts +1 -3
- package/source/private/opcua_client_impl.ts +14 -10
- package/source/reconnection.ts +65 -12
- package/source/tools/findservers.ts +2 -2
package/dist/client_base.d.ts
CHANGED
|
@@ -36,17 +36,8 @@ export interface FindEndpointResult {
|
|
|
36
36
|
export declare type FindEndpointCallback = (err: Error | null, result?: FindEndpointResult) => void;
|
|
37
37
|
export interface TransportSettings {
|
|
38
38
|
maxChunkCount?: number;
|
|
39
|
-
/**
|
|
40
|
-
* @advanced
|
|
41
|
-
*/
|
|
42
39
|
maxMessageSize?: number;
|
|
43
|
-
/**
|
|
44
|
-
* @advanced
|
|
45
|
-
*/
|
|
46
40
|
sendBufferSize?: number;
|
|
47
|
-
/**
|
|
48
|
-
* @advanced
|
|
49
|
-
*/
|
|
50
41
|
receiveBufferSize?: number;
|
|
51
42
|
}
|
|
52
43
|
export interface OPCUAClientBaseOptions {
|
|
@@ -161,111 +152,102 @@ export interface OPCUAClientBase extends OPCUASecureObject {
|
|
|
161
152
|
export interface OPCUAClientBase extends EventEmitter {
|
|
162
153
|
/**
|
|
163
154
|
* this Event is raised when the initial connection has succeeded
|
|
164
|
-
* @param event
|
|
165
|
-
* @param eventHandler
|
|
166
155
|
*/
|
|
167
|
-
on(
|
|
156
|
+
on(eventName: "connected", eventHandler: () => void): this;
|
|
168
157
|
/**
|
|
169
158
|
* this Event is raised when the initial connection has failed
|
|
170
|
-
* @param event
|
|
171
|
-
* @param eventHandler
|
|
172
159
|
*/
|
|
173
|
-
on(
|
|
160
|
+
on(eventName: "connection_failed", eventHandler: (err: Error) => void): this;
|
|
174
161
|
/**
|
|
175
162
|
* this Event is raised when a failing connection is about to be tried again
|
|
176
|
-
* @param event
|
|
177
|
-
* @param eventHandler
|
|
178
163
|
*/
|
|
179
|
-
on(
|
|
164
|
+
on(eventName: "backoff", eventHandler: (count: number, delay: number) => void): this;
|
|
180
165
|
/**
|
|
181
166
|
* this event is raised when the client has encountered a connection failure and
|
|
182
167
|
* and is going to reconnection mode.
|
|
168
|
+
*
|
|
169
|
+
* It notifies the observer that the OPCUA is now trying to reestablish the connection
|
|
170
|
+
* after having received a connection break...
|
|
171
|
+
*
|
|
183
172
|
* You can intercept start_reconnection event to pause your interaction with the remote
|
|
184
173
|
* OPCUA server.
|
|
185
|
-
* @param event
|
|
186
|
-
* @param eventHandler
|
|
187
174
|
*/
|
|
188
|
-
on(
|
|
175
|
+
on(eventName: "start_reconnection", eventHandler: () => void): this;
|
|
189
176
|
/**
|
|
190
177
|
* this event is raised when the client has failed one attempt to reconnect to the server
|
|
191
178
|
* This event will be raised if the socket has successfully being created to the server but
|
|
192
179
|
* if something went wrong during the reconnection process.
|
|
193
|
-
* @param event
|
|
194
|
-
* @param eventHandler
|
|
195
180
|
*/
|
|
196
|
-
on(
|
|
181
|
+
on(eventName: "reconnection_attempt_has_failed", eventHandler: (err: Error, message: string) => void): this;
|
|
197
182
|
/**
|
|
198
183
|
* this event is raised after the client has successfully managed to re-establish the connection with
|
|
199
184
|
* the remote OPCUA Server.
|
|
200
185
|
* You can intercept after_reconnection event to resume your interaction with the remote
|
|
201
186
|
* OPCUA server.
|
|
202
|
-
*
|
|
203
|
-
* @param event
|
|
204
|
-
* @param eventHandler
|
|
205
187
|
*/
|
|
206
|
-
on(
|
|
188
|
+
on(eventName: "after_reconnection", eventHandler: (err?: Error) => void): this;
|
|
207
189
|
/**
|
|
208
190
|
* the event is raised when the connection has been aborted by the remote OPCUA Server
|
|
209
191
|
* @param event
|
|
210
192
|
* @param eventHandler
|
|
211
193
|
*/
|
|
212
|
-
on(
|
|
194
|
+
on(eventName: "abort", eventHandler: () => void): this;
|
|
213
195
|
/**
|
|
214
196
|
* this event is raised when the connection is closed
|
|
215
197
|
* @param event
|
|
216
198
|
* @param eventHandler
|
|
217
199
|
*/
|
|
218
|
-
on(
|
|
200
|
+
on(eventName: "close", eventHandler: () => void): this;
|
|
219
201
|
/**
|
|
220
202
|
* this event is raised when the client is sending a message chunk to the server
|
|
221
203
|
* (advanced use only)
|
|
222
204
|
* @param event
|
|
223
205
|
* @param eventHandler
|
|
224
206
|
*/
|
|
225
|
-
on(
|
|
207
|
+
on(eventName: "send_chunk", eventHandler: (chunk: Buffer) => void): this;
|
|
226
208
|
/**
|
|
227
209
|
* this event is raised when the client has received a new message chunk from the servers
|
|
228
210
|
* (advanced use only)
|
|
229
211
|
* @param event
|
|
230
212
|
* @param eventHandler
|
|
231
213
|
*/
|
|
232
|
-
on(
|
|
233
|
-
on(
|
|
234
|
-
on(
|
|
214
|
+
on(eventName: "receive_chunk", eventHandler: (chunk: Buffer) => void): this;
|
|
215
|
+
on(eventName: "send_request", eventHandler: (request: Request) => void): this;
|
|
216
|
+
on(eventName: "receive_response", eventHandler: (response: Response) => void): this;
|
|
235
217
|
/**
|
|
236
218
|
* this event is raised when the current security token has reached 75% of its lifetime and is therefore
|
|
237
219
|
* about to expired.
|
|
238
220
|
* @param event
|
|
239
221
|
* @param eventHandler
|
|
240
222
|
*/
|
|
241
|
-
on(
|
|
223
|
+
on(eventName: "lifetime_75", eventHandler: (token: ChannelSecurityToken) => void): this;
|
|
242
224
|
/**
|
|
243
225
|
* this event is raised after the (about ) security token as been renewed
|
|
244
226
|
* and renegotiated with the server.to expire
|
|
245
227
|
* @param event
|
|
246
228
|
* @param eventHandler
|
|
247
229
|
*/
|
|
248
|
-
on(
|
|
230
|
+
on(eventName: "security_token_renewed", eventHandler: () => void): this;
|
|
249
231
|
/**
|
|
250
232
|
* this event is raised when the connection has been broken
|
|
251
233
|
* @param event
|
|
252
234
|
* @param eventHandler
|
|
253
235
|
*/
|
|
254
|
-
on(
|
|
236
|
+
on(eventName: "connection_lost", eventHandler: () => void): this;
|
|
255
237
|
/**
|
|
256
238
|
* this event is raised when a broken connection with the remote Server has been reestablished
|
|
257
239
|
* @param event
|
|
258
240
|
* @param eventHandler
|
|
259
241
|
*/
|
|
260
|
-
on(
|
|
242
|
+
on(eventName: "connection_reestablished", eventHandler: () => void): this;
|
|
261
243
|
/**
|
|
262
244
|
* This event is raised when a request sent to the remote OPCUA server has reach it's timeout value without
|
|
263
245
|
* a Response from the server.
|
|
264
246
|
* @param event
|
|
265
247
|
* @param eventHandler
|
|
266
248
|
*/
|
|
267
|
-
on(
|
|
268
|
-
on(
|
|
249
|
+
on(eventName: "timed_out_request", eventHandler: (request: Request) => void): this;
|
|
250
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
269
251
|
}
|
|
270
252
|
export interface OPCUAClientBase {
|
|
271
253
|
readonly endpoint?: EndpointDescription;
|
|
@@ -290,5 +272,6 @@ export interface OPCUAClientBase {
|
|
|
290
272
|
}
|
|
291
273
|
export declare class OPCUAClientBase {
|
|
292
274
|
static registry: ObjectRegistry;
|
|
275
|
+
static retryDelay: number;
|
|
293
276
|
static create(options: OPCUAClientBaseOptions): OPCUAClientBase;
|
|
294
277
|
}
|
package/dist/client_base.js
CHANGED
package/dist/client_base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_base.js","sourceRoot":"","sources":["../source/client_base.ts"],"names":[],"mappings":";;;AASA,2EAA4D;
|
|
1
|
+
{"version":3,"file":"client_base.js","sourceRoot":"","sources":["../source/client_base.ts"],"names":[],"mappings":";;;AASA,2EAA4D;AAkU5D,MAAa,eAAe;IAIjB,MAAM,CAAC,MAAM,CAAC,OAA+B;QAChD,yBAAyB;QACzB,OAAO,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;;AARL,0CASC;AARiB,wBAAQ,GAAG,IAAI,2CAAc,EAAE,CAAC;AAChC,0BAAU,GAAG,IAAI,GAAG,CAAC,CAAC"}
|
package/dist/client_session.d.ts
CHANGED
|
@@ -24,11 +24,11 @@ import { WriteValueOptions } from "node-opcua-service-write";
|
|
|
24
24
|
import { StatusCode } from "node-opcua-status-code";
|
|
25
25
|
import { DataType, Variant } from "node-opcua-variant";
|
|
26
26
|
import { Callback } from "node-opcua-status-code";
|
|
27
|
-
import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
|
|
28
27
|
import { ExtensionObject } from "node-opcua-extension-object";
|
|
29
28
|
import { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
|
|
30
29
|
import { AggregateFunction } from "node-opcua-constants";
|
|
31
30
|
import { HistoryReadRequest, HistoryReadResponse, HistoryReadValueIdOptions } from "node-opcua-types";
|
|
31
|
+
import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
|
|
32
32
|
export { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
|
|
33
33
|
export { ExtensionObject } from "node-opcua-extension-object";
|
|
34
34
|
export { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
|
|
@@ -374,7 +374,7 @@ export interface ClientSessionNamespaceService {
|
|
|
374
374
|
readNamespaceArray(callback: (err: Error | null, namespaceArray?: string[]) => void): void;
|
|
375
375
|
}
|
|
376
376
|
export interface ClientSessionExtensionObjectService {
|
|
377
|
-
constructExtensionObject(dataType: NodeId, pojo:
|
|
377
|
+
constructExtensionObject(dataType: NodeId, pojo: Record<string, unknown>): Promise<ExtensionObject>;
|
|
378
378
|
/**
|
|
379
379
|
* @private
|
|
380
380
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_session.js","sourceRoot":"","sources":["../source/client_session.ts"],"names":[],"mappings":";AAAA;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"client_session.js","sourceRoot":"","sources":["../source/client_session.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA8DH,yGAAkF;AAAzE,kJAAA,oBAAoB,OAAA;AAE7B,2EAA8D;AAArD,8HAAA,eAAe,OAAA"}
|
|
@@ -11,51 +11,37 @@ import { Request, Response } from "../common";
|
|
|
11
11
|
import { CreateSecureChannelCallbackFunc, FindServersOnNetworkRequestLike, FindServersRequestLike, GetEndpointsOptions, OPCUAClientBase, OPCUAClientBaseOptions } from "../client_base";
|
|
12
12
|
import { ClientSessionImpl } from "./client_session_impl";
|
|
13
13
|
import { IClientBase } from "./i_private_client";
|
|
14
|
-
declare type InternalClientState = "uninitialized" | "disconnected" | "connecting" | "connected" | "reconnecting" | "disconnecting";
|
|
14
|
+
declare type InternalClientState = "uninitialized" | "disconnected" | "connecting" | "connected" | "reconnecting" | "reconnecting_newchannel_connected" | "disconnecting";
|
|
15
15
|
/**
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
export declare class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase, IClientBase {
|
|
19
19
|
/**
|
|
20
20
|
* total number of requests that been canceled due to timeout
|
|
21
|
-
* @property timedOutRequestCount
|
|
22
|
-
* @type {Number}
|
|
23
21
|
*/
|
|
24
22
|
get timedOutRequestCount(): number;
|
|
25
23
|
/**
|
|
26
24
|
* total number of transactions performed by the client
|
|
27
|
-
|
|
28
|
-
* @type {Number}
|
|
29
|
-
*/
|
|
25
|
+
x */
|
|
30
26
|
get transactionsPerformed(): number;
|
|
31
27
|
/**
|
|
32
28
|
* is true when the client has already requested the server end points.
|
|
33
|
-
* @property knowsServerEndpoint
|
|
34
|
-
* @type boolean
|
|
35
29
|
*/
|
|
36
30
|
get knowsServerEndpoint(): boolean;
|
|
37
31
|
/**
|
|
38
32
|
* true if the client is trying to reconnect to the server after a connection break.
|
|
39
|
-
* @property isReconnecting
|
|
40
|
-
* @type {Boolean}
|
|
41
33
|
*/
|
|
42
34
|
get isReconnecting(): boolean;
|
|
43
35
|
/**
|
|
44
36
|
* true if the connection strategy is set to automatically try to reconnect in case of failure
|
|
45
|
-
* @property reconnectOnFailure
|
|
46
|
-
* @type {Boolean}
|
|
47
37
|
*/
|
|
48
38
|
get reconnectOnFailure(): boolean;
|
|
49
39
|
/**
|
|
50
40
|
* total number of bytes read by the client
|
|
51
|
-
* @property bytesRead
|
|
52
|
-
* @type {Number}
|
|
53
41
|
*/
|
|
54
42
|
get bytesRead(): number;
|
|
55
43
|
/**
|
|
56
44
|
* total number of bytes written by the client
|
|
57
|
-
* @property bytesWritten
|
|
58
|
-
* @type {Number}
|
|
59
45
|
*/
|
|
60
46
|
get bytesWritten(): number;
|
|
61
47
|
securityMode: MessageSecurityMode;
|
|
@@ -83,10 +69,11 @@ export declare class ClientBaseImpl extends OPCUASecureObject implements OPCUACl
|
|
|
83
69
|
private _byteWritten;
|
|
84
70
|
private _timedOutRequestCount;
|
|
85
71
|
private _transactionsPerformed;
|
|
86
|
-
private
|
|
72
|
+
private _reconnectionIsCanceled;
|
|
87
73
|
private _clockAdjuster?;
|
|
88
74
|
private _tmpClient?;
|
|
89
75
|
private _instanceNumber;
|
|
76
|
+
private _transportSettings;
|
|
90
77
|
clientCertificateManager: OPCUACertificateManager;
|
|
91
78
|
protected _setInternalState(internalState: InternalClientState): void;
|
|
92
79
|
emit(eventName: string | symbol, ...others: any[]): boolean;
|
|
@@ -156,6 +143,7 @@ export declare class ClientBaseImpl extends OPCUASecureObject implements OPCUACl
|
|
|
156
143
|
private _destroy_secure_channel;
|
|
157
144
|
private _close_pending_sessions;
|
|
158
145
|
private _install_secure_channel_event_handlers;
|
|
146
|
+
_inside_repairConnection: boolean;
|
|
159
147
|
private _repairConnection;
|
|
160
148
|
private _finalReconnectionStep;
|
|
161
149
|
/**
|