node-opcua-client 2.178.0 → 2.179.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/alarms_and_conditions/client_alarm_tools.js +7 -5
- package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
- package/dist/alarms_and_conditions/client_tools.js +38 -28
- package/dist/alarms_and_conditions/client_tools.js.map +1 -1
- package/dist/client_base.js.map +1 -1
- package/dist/client_monitored_item.d.ts +1 -1
- package/dist/client_monitored_item.js +4 -2
- package/dist/client_monitored_item.js.map +1 -1
- package/dist/client_monitored_item_group.d.ts +4 -3
- package/dist/client_monitored_item_group.js +8 -5
- package/dist/client_monitored_item_group.js.map +1 -1
- package/dist/client_monitored_item_toolbox.js +4 -2
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session.d.ts +9 -2
- package/dist/client_session_keepalive_manager.d.ts +1 -1
- package/dist/client_session_keepalive_manager.js +50 -29
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/client_subscription.d.ts +2 -2
- package/dist/client_subscription.js +3 -1
- package/dist/client_subscription.js.map +1 -1
- package/dist/common.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/opcua_client.js +1 -0
- package/dist/opcua_client.js.map +1 -1
- package/dist/private/client_base_impl.js +125 -65
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_group_impl.d.ts +1 -0
- package/dist/private/client_monitored_item_group_impl.js +6 -8
- package/dist/private/client_monitored_item_group_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.js +0 -4
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_publish_engine.js +62 -28
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +49 -17
- package/dist/private/client_session_impl.js +240 -143
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.js +15 -12
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/i_private_client.d.ts +1 -1
- package/dist/private/opcua_client_impl.js +12 -10
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/reconnection/client_publish_engine_reconnection.js +17 -7
- package/dist/private/reconnection/client_publish_engine_reconnection.js.map +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.js +11 -7
- package/dist/private/reconnection/client_subscription_reconnection.js.map +1 -1
- package/dist/private/reconnection/reconnection.js +31 -14
- package/dist/private/reconnection/reconnection.js.map +1 -1
- package/dist/reverse/client_reverse_connect.js.map +1 -1
- package/dist/tools/findservers.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.d.ts +2 -1
- package/dist/tools/read_history_server_capabilities.js +6 -3
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/package.json +50 -50
- package/source/alarms_and_conditions/client_alarm_tools.ts +10 -8
- package/source/alarms_and_conditions/client_tools.ts +71 -30
- package/source/client_base.ts +0 -1
- package/source/client_monitored_item.ts +10 -9
- package/source/client_monitored_item_base.ts +2 -8
- package/source/client_monitored_item_group.ts +13 -10
- package/source/client_monitored_item_toolbox.ts +4 -2
- package/source/client_session.ts +10 -3
- package/source/client_session_keepalive_manager.ts +72 -55
- package/source/client_subscription.ts +6 -3
- package/source/common.ts +4 -0
- package/source/index.ts +1 -1
- package/source/opcua_client.ts +1 -0
- package/source/private/client_base_impl.ts +179 -102
- package/source/private/client_monitored_item_group_impl.ts +17 -18
- package/source/private/client_monitored_item_impl.ts +0 -4
- package/source/private/client_publish_engine.ts +78 -40
- package/source/private/client_session_impl.ts +393 -236
- package/source/private/client_subscription_impl.ts +20 -25
- package/source/private/i_private_client.ts +1 -1
- package/source/private/opcua_client_impl.ts +13 -10
- package/source/private/reconnection/client_publish_engine_reconnection.ts +22 -21
- package/source/private/reconnection/client_subscription_reconnection.ts +12 -8
- package/source/private/reconnection/reconnection.ts +35 -18
- package/source/reverse/client_reverse_connect.ts +11 -3
- package/source/tools/findservers.ts +0 -1
- package/source/tools/read_history_server_capabilities.ts +9 -7
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-client-private
|
|
3
3
|
*/
|
|
4
|
-
// tslint:disable:no-empty
|
|
5
4
|
import { EventEmitter } from "node:events";
|
|
6
5
|
import { assert } from "node-opcua-assert";
|
|
7
6
|
import { coerceTimestampsToReturn, type DataValue, TimestampsToReturn } from "node-opcua-data-value";
|
|
8
|
-
import {
|
|
7
|
+
import { make_warningLog } from "node-opcua-debug";
|
|
9
8
|
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
10
9
|
import { MonitoringMode, type MonitoringParametersOptions } from "node-opcua-service-subscription";
|
|
11
10
|
import type { Callback, ErrorCallback, StatusCode } from "node-opcua-status-code";
|
|
@@ -17,7 +16,6 @@ import type { ClientSubscription } from "../client_subscription";
|
|
|
17
16
|
import { ClientMonitoredItemImpl } from "./client_monitored_item_impl";
|
|
18
17
|
import type { ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
19
18
|
|
|
20
|
-
|
|
21
19
|
const warningLog = make_warningLog(__filename);
|
|
22
20
|
|
|
23
21
|
/**
|
|
@@ -34,6 +32,7 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
34
32
|
private readonly subscription: ClientSubscription;
|
|
35
33
|
private timestampsToReturn: TimestampsToReturn;
|
|
36
34
|
private readonly monitoringMode: MonitoringMode;
|
|
35
|
+
private _terminated = false;
|
|
37
36
|
|
|
38
37
|
constructor(
|
|
39
38
|
subscription: ClientSubscription,
|
|
@@ -91,11 +90,11 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
91
90
|
*/
|
|
92
91
|
public async terminate(): Promise<void>;
|
|
93
92
|
public terminate(done: ErrorCallback): void;
|
|
94
|
-
public terminate(...args:
|
|
93
|
+
public terminate(...args: unknown[]): unknown {
|
|
95
94
|
const done = args[0] as ErrorCallback;
|
|
96
95
|
assert(!done || typeof done === "function");
|
|
97
96
|
const subscription = this.subscription as ClientSubscriptionImpl;
|
|
98
|
-
subscription._delete_monitored_items(this.monitoredItems, (err?: Error) => {
|
|
97
|
+
return subscription._delete_monitored_items(this.monitoredItems, (err?: Error) => {
|
|
99
98
|
subscription._removeGroup(this);
|
|
100
99
|
|
|
101
100
|
if (done) {
|
|
@@ -104,27 +103,29 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
104
103
|
});
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
// tslint:disable:unified-signatures
|
|
108
106
|
/**
|
|
109
107
|
|
|
110
108
|
*/
|
|
111
109
|
public async modify(parameters: MonitoringParametersOptions): Promise<MonitoredItemModifyResult>;
|
|
112
|
-
public async modify(
|
|
110
|
+
public async modify(
|
|
111
|
+
parameters: MonitoringParametersOptions,
|
|
112
|
+
timestampsToReturn: TimestampsToReturn
|
|
113
|
+
): Promise<MonitoredItemModifyResult>;
|
|
113
114
|
public modify(parameters: MonitoringParametersOptions, callback: Callback<MonitoredItemModifyResult>): void;
|
|
114
115
|
public modify(
|
|
115
116
|
parameters: MonitoringParametersOptions,
|
|
116
117
|
timestampsToReturn: TimestampsToReturn | null,
|
|
117
118
|
callback: Callback<MonitoredItemModifyResult>
|
|
118
119
|
): void;
|
|
119
|
-
public modify(...args:
|
|
120
|
+
public modify(...args: unknown[]): unknown {
|
|
120
121
|
if (args.length === 2) {
|
|
121
|
-
return this.modify(args[0], null, args[1]);
|
|
122
|
+
return this.modify(args[0] as MonitoringParametersOptions, null, args[1] as Callback<MonitoredItemModifyResult>);
|
|
122
123
|
}
|
|
123
124
|
const parameters = args[0] as MonitoringParametersOptions;
|
|
124
125
|
const timestampsToReturn = args[1] as TimestampsToReturn;
|
|
125
126
|
const callback = args[2] as ErrorCallback;
|
|
126
127
|
this.timestampsToReturn = timestampsToReturn || this.timestampsToReturn;
|
|
127
|
-
ClientMonitoredItemToolbox._toolbox_modify(
|
|
128
|
+
return ClientMonitoredItemToolbox._toolbox_modify(
|
|
128
129
|
this.subscription,
|
|
129
130
|
this.monitoredItems,
|
|
130
131
|
parameters,
|
|
@@ -137,16 +138,16 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
137
138
|
|
|
138
139
|
public async setMonitoringMode(monitoringMode: MonitoringMode): Promise<StatusCode>;
|
|
139
140
|
public setMonitoringMode(monitoringMode: MonitoringMode, callback: Callback<StatusCode>): void;
|
|
140
|
-
public setMonitoringMode(...args:
|
|
141
|
+
public setMonitoringMode(...args: unknown[]): unknown {
|
|
141
142
|
const monitoringMode = args[0] as MonitoringMode;
|
|
142
143
|
const callback = args[1] as Callback<StatusCode>;
|
|
143
|
-
ClientMonitoredItemToolbox._toolbox_setMonitoringMode(
|
|
144
|
+
return ClientMonitoredItemToolbox._toolbox_setMonitoringMode(
|
|
144
145
|
this.subscription,
|
|
145
146
|
this.monitoredItems,
|
|
146
147
|
monitoringMode,
|
|
147
148
|
(err: Error | null, statusCode?: StatusCode[]) => {
|
|
148
149
|
// todo fix me
|
|
149
|
-
callback(err, statusCode
|
|
150
|
+
callback(err, statusCode?.[0]);
|
|
150
151
|
}
|
|
151
152
|
);
|
|
152
153
|
}
|
|
@@ -201,8 +202,8 @@ Please investigate the code of the event handler function to fix the error.`
|
|
|
201
202
|
);
|
|
202
203
|
}
|
|
203
204
|
public _terminate_and_emit(err?: Error): void {
|
|
204
|
-
assert(!
|
|
205
|
-
|
|
205
|
+
assert(!this._terminated);
|
|
206
|
+
this._terminated = true;
|
|
206
207
|
if (err) {
|
|
207
208
|
this.emit("err", err.message);
|
|
208
209
|
}
|
|
@@ -210,11 +211,9 @@ Please investigate the code of the event handler function to fix the error.`
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
|
|
213
|
-
// tslint:disable:no-var-requires
|
|
214
|
-
// tslint:disable:max-line-length
|
|
215
214
|
import { withCallback } from "thenify-ex";
|
|
216
215
|
|
|
217
|
-
const
|
|
216
|
+
const _opts = { multiArgs: false };
|
|
218
217
|
|
|
219
218
|
ClientMonitoredItemGroupImpl.prototype.terminate = withCallback(ClientMonitoredItemGroupImpl.prototype.terminate);
|
|
220
219
|
ClientMonitoredItemGroupImpl.prototype.setMonitoringMode = withCallback(ClientMonitoredItemGroupImpl.prototype.setMonitoringMode);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-client-private
|
|
3
3
|
*/
|
|
4
|
-
// tslint:disable:unified-signatures
|
|
5
|
-
// tslint:disable:no-empty
|
|
6
4
|
import { EventEmitter } from "node:events";
|
|
7
5
|
import { assert } from "node-opcua-assert";
|
|
8
6
|
|
|
@@ -404,8 +402,6 @@ export class ClientMonitoredItemImpl extends EventEmitter implements ClientMonit
|
|
|
404
402
|
}
|
|
405
403
|
}
|
|
406
404
|
|
|
407
|
-
// tslint:disable:no-var-requires
|
|
408
|
-
// tslint:disable:max-line-length
|
|
409
405
|
import { withCallback } from "thenify-ex";
|
|
410
406
|
|
|
411
407
|
const _opts = { multiArgs: false };
|
|
@@ -5,7 +5,9 @@ import chalk from "chalk";
|
|
|
5
5
|
import { assert } from "node-opcua-assert";
|
|
6
6
|
import { getMinOPCUADate } from "node-opcua-date-time";
|
|
7
7
|
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
8
|
+
import type { ServiceFaultAnnotatedError } from "node-opcua-secure-channel";
|
|
8
9
|
import { PublishRequest, type PublishResponse } from "node-opcua-service-subscription";
|
|
10
|
+
import type { SubscriptionAcknowledgementOptions } from "node-opcua-types";
|
|
9
11
|
|
|
10
12
|
import type { ClientSession, SubscriptionId } from "../client_session";
|
|
11
13
|
import type { ClientSubscription } from "../client_subscription";
|
|
@@ -35,7 +37,7 @@ export class ClientSidePublishEngine {
|
|
|
35
37
|
public nbMaxPublishRequestsAcceptedByServer: number;
|
|
36
38
|
public isSuspended: boolean;
|
|
37
39
|
public session: ClientSession | null;
|
|
38
|
-
private subscriptionAcknowledgements:
|
|
40
|
+
private subscriptionAcknowledgements: SubscriptionAcknowledgementOptions[];
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* @internal
|
|
@@ -128,7 +130,8 @@ export class ClientSidePublishEngine {
|
|
|
128
130
|
* @private
|
|
129
131
|
*/
|
|
130
132
|
public terminate(): void {
|
|
131
|
-
|
|
133
|
+
// c8 ignore next
|
|
134
|
+
doDebug && debugLog("Terminated ClientPublishEngine ");
|
|
132
135
|
this.session = null;
|
|
133
136
|
}
|
|
134
137
|
|
|
@@ -136,21 +139,22 @@ export class ClientSidePublishEngine {
|
|
|
136
139
|
* @private
|
|
137
140
|
*/
|
|
138
141
|
public registerSubscription(subscription: ClientSubscription): void {
|
|
139
|
-
|
|
142
|
+
// c8 ignore next
|
|
143
|
+
doDebug && debugLog("ClientSidePublishEngine#registerSubscription ", subscription.subscriptionId);
|
|
140
144
|
|
|
141
145
|
const _subscription = subscription as ClientSubscriptionImpl;
|
|
142
|
-
assert(
|
|
143
|
-
assert(isFinite(subscription.subscriptionId));
|
|
146
|
+
assert(Number.isFinite(subscription.subscriptionId));
|
|
144
147
|
assert(!Object.hasOwn(this.subscriptionMap, subscription.subscriptionId)); // already registered ?
|
|
145
148
|
assert(typeof _subscription.onNotificationMessage === "function");
|
|
146
|
-
assert(isFinite(subscription.timeoutHint));
|
|
149
|
+
assert(Number.isFinite(subscription.timeoutHint));
|
|
147
150
|
|
|
148
151
|
this.activeSubscriptionCount += 1;
|
|
149
152
|
this.subscriptionMap[subscription.subscriptionId] = _subscription;
|
|
150
153
|
|
|
151
154
|
this.timeoutHint = Math.min(Math.max(this.timeoutHint, subscription.timeoutHint), 0x7ffffff);
|
|
152
155
|
|
|
153
|
-
|
|
156
|
+
// c8 ignore next
|
|
157
|
+
doDebug && debugLog(" setting timeoutHint = ", this.timeoutHint, subscription.timeoutHint);
|
|
154
158
|
|
|
155
159
|
this.replenish_publish_request_queue();
|
|
156
160
|
}
|
|
@@ -179,9 +183,10 @@ export class ClientSidePublishEngine {
|
|
|
179
183
|
* @private
|
|
180
184
|
*/
|
|
181
185
|
public unregisterSubscription(subscriptionId: SubscriptionId): void {
|
|
182
|
-
|
|
186
|
+
// c8 ignore next
|
|
187
|
+
doDebug && debugLog("ClientSidePublishEngine#unregisterSubscription ", subscriptionId);
|
|
183
188
|
|
|
184
|
-
assert(isFinite(subscriptionId) && subscriptionId > 0);
|
|
189
|
+
assert(Number.isFinite(subscriptionId) && subscriptionId > 0);
|
|
185
190
|
this.activeSubscriptionCount -= 1;
|
|
186
191
|
// note : it is possible that we get here while the server has already requested
|
|
187
192
|
// a session shutdown ... in this case it is possible that subscriptionId is already
|
|
@@ -189,7 +194,8 @@ export class ClientSidePublishEngine {
|
|
|
189
194
|
if (Object.hasOwn(this.subscriptionMap, subscriptionId)) {
|
|
190
195
|
delete this.subscriptionMap[subscriptionId];
|
|
191
196
|
} else {
|
|
192
|
-
|
|
197
|
+
// c8 ignore next
|
|
198
|
+
doDebug && debugLog("ClientSidePublishEngine#unregisterSubscription cannot find subscription ", subscriptionId);
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
201
|
|
|
@@ -201,22 +207,26 @@ export class ClientSidePublishEngine {
|
|
|
201
207
|
* get the client subscription from Id
|
|
202
208
|
*/
|
|
203
209
|
public getSubscription(subscriptionId: SubscriptionId): ClientSubscription {
|
|
204
|
-
assert(isFinite(subscriptionId) && subscriptionId > 0);
|
|
210
|
+
assert(Number.isFinite(subscriptionId) && subscriptionId > 0);
|
|
205
211
|
assert(Object.hasOwn(this.subscriptionMap, subscriptionId));
|
|
206
212
|
return this.subscriptionMap[subscriptionId];
|
|
207
213
|
}
|
|
208
214
|
|
|
209
215
|
public hasSubscription(subscriptionId: SubscriptionId): boolean {
|
|
210
|
-
assert(isFinite(subscriptionId) && subscriptionId > 0);
|
|
216
|
+
assert(Number.isFinite(subscriptionId) && subscriptionId > 0);
|
|
211
217
|
return Object.hasOwn(this.subscriptionMap, subscriptionId);
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
public internalSendPublishRequest(): void {
|
|
215
221
|
assert(this.session, "ClientSidePublishEngine terminated ?");
|
|
222
|
+
if (!this.session) {
|
|
223
|
+
throw new Error("ClientSidePublishEngine terminated ?");
|
|
224
|
+
}
|
|
216
225
|
|
|
217
226
|
this.nbPendingPublishRequests += 1;
|
|
218
227
|
|
|
219
|
-
|
|
228
|
+
// c8 ignore next
|
|
229
|
+
doDebug && debugLog(chalk.yellow("sending publish request "), this.nbPendingPublishRequests);
|
|
220
230
|
|
|
221
231
|
const subscriptionAcknowledgements = this.subscriptionAcknowledgements;
|
|
222
232
|
this.subscriptionAcknowledgements = [];
|
|
@@ -260,22 +270,38 @@ export class ClientSidePublishEngine {
|
|
|
260
270
|
|
|
261
271
|
let active = true;
|
|
262
272
|
|
|
263
|
-
const session = this.session
|
|
273
|
+
const session = this.session as ClientSessionImpl;
|
|
264
274
|
session.publish(publishRequest, (err: Error | null, response?: PublishResponse) => {
|
|
265
275
|
this.nbPendingPublishRequests -= 1;
|
|
266
276
|
|
|
267
|
-
this
|
|
277
|
+
// despite its name, this timestamp records the *answer*, not the send: it is what
|
|
278
|
+
// ClientSubscriptionImpl.evaluateRemainingLifetime() uses to estimate when the server
|
|
279
|
+
// will drop the subscription. A publish that failed on a timeout or a broken channel
|
|
280
|
+
// says nothing about the server and must not move it, or the subscription would look
|
|
281
|
+
// healthy for the whole outage. A ServiceFault does count - the server answered.
|
|
282
|
+
// Same rule as ClientSessionImpl.lastResponseReceivedTime (see #1569).
|
|
283
|
+
if (response || (err as ServiceFaultAnnotatedError)?.response) {
|
|
284
|
+
this.lastRequestSentTime = new Date();
|
|
285
|
+
}
|
|
268
286
|
|
|
269
287
|
if (err) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
288
|
+
// c8 ignore next
|
|
289
|
+
if (doDebug) {
|
|
290
|
+
debugLog(
|
|
291
|
+
chalk.cyan("ClientSidePublishEngine.prototype.internalSendPublishRequest callback : "),
|
|
292
|
+
chalk.yellow(err.message)
|
|
293
|
+
);
|
|
294
|
+
debugLog(`'${err.message}'`);
|
|
295
|
+
}
|
|
275
296
|
|
|
276
297
|
if (err.message.match("not connected")) {
|
|
277
|
-
|
|
278
|
-
|
|
298
|
+
// c8 ignore next
|
|
299
|
+
if (doDebug) {
|
|
300
|
+
debugLog(
|
|
301
|
+
chalk.bgWhite.red(" WARNING : CLIENT IS NOT CONNECTED :" + " MAY BE RECONNECTION IS IN PROGRESS")
|
|
302
|
+
);
|
|
303
|
+
debugLog("this.activeSubscriptionCount =", this.activeSubscriptionCount);
|
|
304
|
+
}
|
|
279
305
|
// the previous publish request has ended up with an error because
|
|
280
306
|
// the connection has failed ...
|
|
281
307
|
// There is no need to send more publish request for the time being until reconnection is completed
|
|
@@ -287,8 +313,11 @@ export class ClientSidePublishEngine {
|
|
|
287
313
|
// the server tells us that there is no subscription for this session
|
|
288
314
|
// but the client have some active subscription left.
|
|
289
315
|
// This could happen if the client has missed or not received the StatusChange Notification
|
|
290
|
-
|
|
291
|
-
|
|
316
|
+
// c8 ignore next
|
|
317
|
+
if (doDebug) {
|
|
318
|
+
debugLog(chalk.bgWhite.red(" WARNING: server tells that there is no Subscription, but client disagree"));
|
|
319
|
+
debugLog("this.activeSubscriptionCount =", this.activeSubscriptionCount);
|
|
320
|
+
}
|
|
292
321
|
active = false;
|
|
293
322
|
}
|
|
294
323
|
|
|
@@ -298,10 +327,13 @@ export class ClientSidePublishEngine {
|
|
|
298
327
|
// may be the session timeout is shorted than the subscription life time
|
|
299
328
|
// and the client does not send intermediate keepAlive request to keep the connection working.
|
|
300
329
|
//
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
"
|
|
304
|
-
|
|
330
|
+
// c8 ignore next
|
|
331
|
+
if (doDebug) {
|
|
332
|
+
debugLog(chalk.bgWhite.red(" WARNING : Server tells that the session has closed ..."));
|
|
333
|
+
debugLog(
|
|
334
|
+
" the ClientSidePublishEngine shall now be disabled," + " as server will reject any further request"
|
|
335
|
+
);
|
|
336
|
+
}
|
|
305
337
|
// close all active subscription....
|
|
306
338
|
active = false;
|
|
307
339
|
}
|
|
@@ -332,24 +364,26 @@ export class ClientSidePublishEngine {
|
|
|
332
364
|
// completed the session transfer. We should pause and let the
|
|
333
365
|
// reconnection flow replenish publish requests once the session
|
|
334
366
|
// transfer completes.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
367
|
+
// c8 ignore next
|
|
368
|
+
doDebug &&
|
|
369
|
+
debugLog(
|
|
370
|
+
chalk.bgWhite.yellow(
|
|
371
|
+
" WARNING: BadSecureChannelIdInvalid on PublishRequest" + " - session transfer may be in progress"
|
|
372
|
+
)
|
|
373
|
+
);
|
|
340
374
|
active = false;
|
|
341
375
|
}
|
|
342
|
-
} else {
|
|
376
|
+
} else if (response) {
|
|
343
377
|
// c8 ignore next
|
|
344
378
|
if (doDebug) {
|
|
345
379
|
debugLog(chalk.cyan("ClientSidePublishEngine.prototype.internalSendPublishRequest callback "));
|
|
346
380
|
}
|
|
347
|
-
this._receive_publish_response(response
|
|
381
|
+
this._receive_publish_response(response);
|
|
348
382
|
}
|
|
349
383
|
|
|
350
384
|
// feed the server with a new publish Request to the server
|
|
351
385
|
if (!this.isSuspended && active && this.activeSubscriptionCount > 0) {
|
|
352
|
-
if (err
|
|
386
|
+
if (err?.message.match(/Connection Break/)) {
|
|
353
387
|
// do not renew when connection is broken
|
|
354
388
|
} else {
|
|
355
389
|
this.send_publish_request();
|
|
@@ -359,7 +393,8 @@ export class ClientSidePublishEngine {
|
|
|
359
393
|
}
|
|
360
394
|
|
|
361
395
|
private _receive_publish_response(response: PublishResponse) {
|
|
362
|
-
|
|
396
|
+
// c8 ignore next
|
|
397
|
+
doDebug && debugLog(chalk.yellow("receive publish response"));
|
|
363
398
|
|
|
364
399
|
// the id of the subscription sending the notification message
|
|
365
400
|
const subscriptionId = response.subscriptionId;
|
|
@@ -401,9 +436,12 @@ export class ClientSidePublishEngine {
|
|
|
401
436
|
}
|
|
402
437
|
}
|
|
403
438
|
} else {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
439
|
+
// c8 ignore next
|
|
440
|
+
if (doDebug) {
|
|
441
|
+
debugLog(" ignoring notificationMessage", notificationMessage, " for subscription", subscriptionId);
|
|
442
|
+
debugLog(" because there is no subscription.");
|
|
443
|
+
debugLog(" or because there is no session for the subscription (session terminated ?).");
|
|
444
|
+
}
|
|
407
445
|
}
|
|
408
446
|
}
|
|
409
447
|
}
|