@flowcore/sdk 1.26.2 → 1.26.4
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/CHANGELOG.md +15 -0
- package/esm/commands/ai-agent-coordinator/conversation-stream.command.d.ts +1 -1
- package/esm/commands/ai-agent-coordinator/conversation-stream.command.d.ts.map +1 -1
- package/esm/commands/ai-agent-coordinator/conversation-stream.command.js +1 -1
- package/esm/common/websocket-client.d.ts.map +1 -1
- package/esm/common/websocket-client.js +22 -6
- package/package.json +1 -1
- package/script/commands/ai-agent-coordinator/conversation-stream.command.d.ts +1 -1
- package/script/commands/ai-agent-coordinator/conversation-stream.command.d.ts.map +1 -1
- package/script/commands/ai-agent-coordinator/conversation-stream.command.js +1 -1
- package/script/common/websocket-client.d.ts.map +1 -1
- package/script/common/websocket-client.js +22 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.26.4](https://github.com/flowcore-io/flowcore-sdk/compare/v1.26.3...v1.26.4) (2025-04-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **ai-agent-coordinator:** :art: make conversationId optional in ConversationStreamConfig ([c0ea7dc](https://github.com/flowcore-io/flowcore-sdk/commit/c0ea7dce6137a957bc2f972ea38709d7f378fa40))
|
|
9
|
+
|
|
10
|
+
## [1.26.3](https://github.com/flowcore-io/flowcore-sdk/compare/v1.26.2...v1.26.3) (2025-04-10)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **ai-agent-coordinator:** :art: update WebSocket path format in conversation stream command ([2765218](https://github.com/flowcore-io/flowcore-sdk/commit/276521843729dbbc3755fd63b923e59b3066f9a7))
|
|
16
|
+
* **websocket-client:** :art: improve WebSocket URL construction and logging ([9d2ca4e](https://github.com/flowcore-io/flowcore-sdk/commit/9d2ca4e0570cd38e1af137c7520ec692c0f972aa))
|
|
17
|
+
|
|
3
18
|
## [1.26.2](https://github.com/flowcore-io/flowcore-sdk/compare/v1.26.1...v1.26.2) (2025-04-10)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -4,7 +4,7 @@ import type { WebSocketCommand } from "../../common/websocket-command.js";
|
|
|
4
4
|
* Only requires the conversationId.
|
|
5
5
|
*/
|
|
6
6
|
export interface ConversationStreamConfig {
|
|
7
|
-
conversationId
|
|
7
|
+
conversationId?: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Payload type for messages sent *to* the Conversation Stream.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-stream.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-stream.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation-stream.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-stream.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,yBACX,YAAW,gBAAgB,CAAC,wBAAwB,EAAE,6BAA6B,CAAC;IACpF,OAAO,CAAC,MAAM,CAA0B;gBAE5B,MAAM,EAAE,wBAAwB;IAO5C,oDAAoD;IACpD,SAAS,IAAI,wBAAwB;IAIrC,kCAAkC;IAClC,mBAAmB,IAAI,MAAM;IAK7B,sCAAsC;IACtC,uBAAuB,IAAI,MAAM;IAKjC,iDAAiD;IACjD,oBAAoB,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM;CAOrE"}
|
|
@@ -26,7 +26,7 @@ export class ConversationStreamCommand {
|
|
|
26
26
|
/** Get the WebSocket path segment. */
|
|
27
27
|
getWebSocketPathSegment() {
|
|
28
28
|
// Path includes the conversation ID
|
|
29
|
-
return
|
|
29
|
+
return `api/v1/stream/${this.config.conversationId ? `${this.config.conversationId}` : ""}`;
|
|
30
30
|
}
|
|
31
31
|
/** Serializer function for outgoing payloads. */
|
|
32
32
|
serializeSendPayload(payload) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-client.d.ts","sourceRoot":"","sources":["../../src/common/websocket-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAIrF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACjD,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAMD,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAA;IAC3B,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE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B,CAAC,MAAM,EAAE,WAAW,CAAC,GAC7C,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAyD9C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwF1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiFxB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAmBnB;;OAEG;IACH,UAAU;IAyBV;;OAEG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGzB"}
|
|
@@ -162,7 +162,10 @@ export class WebSocketClient {
|
|
|
162
162
|
else {
|
|
163
163
|
throw new Error("Invalid authentication configuration.");
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
// Ensure exactly one slash between base URL and path segment
|
|
166
|
+
const cleanedBaseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
167
|
+
const cleanedPathSegment = pathSegment.startsWith("/") ? pathSegment.slice(1) : pathSegment;
|
|
168
|
+
const streamUrl = `${cleanedBaseUrl}/${cleanedPathSegment}?${urlParams.toString()}`; // Construct URL from command parts
|
|
166
169
|
this.logger.debug(`Connecting to WebSocket URL: ${streamUrl}`);
|
|
167
170
|
this.webSocket = this.webSocketFactory(streamUrl);
|
|
168
171
|
this.setupEventHandlers(); // Sets up handlers that push to internalSubject
|
|
@@ -192,7 +195,10 @@ export class WebSocketClient {
|
|
|
192
195
|
// Use potentially overridden base URL in logging
|
|
193
196
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl();
|
|
194
197
|
const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig);
|
|
195
|
-
|
|
198
|
+
const logUrl = baseUrl && pathSegment
|
|
199
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
200
|
+
: "(unknown URL)";
|
|
201
|
+
this.logger.info(`WebSocket connection opened: ${logUrl}`);
|
|
196
202
|
this.reconnectInterval = this.options.reconnectInterval;
|
|
197
203
|
this.reconnectAttempts = 0;
|
|
198
204
|
};
|
|
@@ -231,7 +237,11 @@ export class WebSocketClient {
|
|
|
231
237
|
// Use potentially overridden base URL in logging
|
|
232
238
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl();
|
|
233
239
|
const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig);
|
|
234
|
-
|
|
240
|
+
const logUrl = baseUrl && pathSegment
|
|
241
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
242
|
+
: "(unknown URL)";
|
|
243
|
+
this.logger.info(`WebSocket connection closed: ${logUrl} Code [${event.code}], Reason: ${event.reason || "No reason given"}
|
|
244
|
+
. Was open: ${wasOpen}`);
|
|
235
245
|
if (wasOpen && event.code !== 1000 && this.currentCommand) { // Only reconnect if command is still set
|
|
236
246
|
this.attemptReconnect();
|
|
237
247
|
}
|
|
@@ -246,7 +256,10 @@ export class WebSocketClient {
|
|
|
246
256
|
// Use potentially overridden base URL in logging
|
|
247
257
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl();
|
|
248
258
|
const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig);
|
|
249
|
-
|
|
259
|
+
const logUrl = baseUrl && pathSegment
|
|
260
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
261
|
+
: "(unknown URL)";
|
|
262
|
+
this.logger.error(`WebSocket encountered an error for stream: ${logUrl}.`);
|
|
250
263
|
if (this.webSocket.readyState !== dntShim.WebSocket.CLOSED &&
|
|
251
264
|
this.webSocket.readyState !== dntShim.WebSocket.CLOSING) {
|
|
252
265
|
this.webSocket.close(1011, "WebSocket error");
|
|
@@ -274,8 +287,11 @@ export class WebSocketClient {
|
|
|
274
287
|
// Use potentially overridden base URL
|
|
275
288
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand.getWebSocketBaseUrl();
|
|
276
289
|
const pathSegment = this.currentCommand.getWebSocketPathSegment(this.currentConfig);
|
|
290
|
+
const logUrl = baseUrl && pathSegment
|
|
291
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
292
|
+
: "(unknown URL)";
|
|
277
293
|
if (this.options.maxReconnects && this.reconnectAttempts >= this.options.maxReconnects) {
|
|
278
|
-
this.logger.error(`Max reconnect attempts (${this.reconnectAttempts}/${this.options.maxReconnects}) reached. Giving up: ${
|
|
294
|
+
this.logger.error(`Max reconnect attempts (${this.reconnectAttempts}/${this.options.maxReconnects}) reached. Giving up: ${logUrl}`);
|
|
279
295
|
if (!this.internalSubject.closed)
|
|
280
296
|
this.internalSubject.complete();
|
|
281
297
|
this.currentCommand = null;
|
|
@@ -285,7 +301,7 @@ export class WebSocketClient {
|
|
|
285
301
|
this.reconnectAttempts++;
|
|
286
302
|
this._isConnecting = true;
|
|
287
303
|
this.logger.info(`Attempting reconnection ${this.reconnectAttempts}${this.options.maxReconnects ? `/${this.options.maxReconnects}` : ""}
|
|
288
|
-
for ${
|
|
304
|
+
for ${logUrl} in ${this.reconnectInterval} ms...`);
|
|
289
305
|
setTimeout(async () => {
|
|
290
306
|
// Check if disconnect was called while waiting
|
|
291
307
|
if (!this.currentCommand || !this.currentConfig) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import type { WebSocketCommand } from "../../common/websocket-command.js";
|
|
|
4
4
|
* Only requires the conversationId.
|
|
5
5
|
*/
|
|
6
6
|
export interface ConversationStreamConfig {
|
|
7
|
-
conversationId
|
|
7
|
+
conversationId?: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Payload type for messages sent *to* the Conversation Stream.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-stream.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-stream.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation-stream.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-stream.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,yBACX,YAAW,gBAAgB,CAAC,wBAAwB,EAAE,6BAA6B,CAAC;IACpF,OAAO,CAAC,MAAM,CAA0B;gBAE5B,MAAM,EAAE,wBAAwB;IAO5C,oDAAoD;IACpD,SAAS,IAAI,wBAAwB;IAIrC,kCAAkC;IAClC,mBAAmB,IAAI,MAAM;IAK7B,sCAAsC;IACtC,uBAAuB,IAAI,MAAM;IAKjC,iDAAiD;IACjD,oBAAoB,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM;CAOrE"}
|
|
@@ -29,7 +29,7 @@ class ConversationStreamCommand {
|
|
|
29
29
|
/** Get the WebSocket path segment. */
|
|
30
30
|
getWebSocketPathSegment() {
|
|
31
31
|
// Path includes the conversation ID
|
|
32
|
-
return
|
|
32
|
+
return `api/v1/stream/${this.config.conversationId ? `${this.config.conversationId}` : ""}`;
|
|
33
33
|
}
|
|
34
34
|
/** Serializer function for outgoing payloads. */
|
|
35
35
|
serializeSendPayload(payload) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-client.d.ts","sourceRoot":"","sources":["../../src/common/websocket-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAAiB,KAAK,M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IACpC,OAAO,CAAC,OAAO,CAE6C;IAC5D,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,iBAAiB,CAAQ;IACjC,OAAO,CAAC,iBAAiB,CAAI;IAC7B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,gBAAgB,CAAkB;IAE1C,OAAO,CAAC,eAAe,CAAmD;IAE1E,OAAO,CAAC,cAAc,CAAkD;IACxE,OAAO,CAAC,aAAa,CAAuB;IAE5C;;;;;OAKG;gBAEgB,WAAW,EAAE,aAAa,EAC3C,OAAO,CAAC,EAAE,sBAAsB,EAChC,gBAAgB,CAAC,EAAE,gBAAgB;IAarC;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKjC;;OAEG;IACH,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED;;;;;OAKG;IAEG,OAAO,CAAC,MAAM,EAAE,WAAW,EAC/B,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,GAC7C,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAyD9C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwF1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiFxB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAmBnB;;OAEG;IACH,UAAU;IAyBV;;OAEG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGzB"}
|
|
@@ -188,7 +188,10 @@ class WebSocketClient {
|
|
|
188
188
|
else {
|
|
189
189
|
throw new Error("Invalid authentication configuration.");
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
// Ensure exactly one slash between base URL and path segment
|
|
192
|
+
const cleanedBaseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
193
|
+
const cleanedPathSegment = pathSegment.startsWith("/") ? pathSegment.slice(1) : pathSegment;
|
|
194
|
+
const streamUrl = `${cleanedBaseUrl}/${cleanedPathSegment}?${urlParams.toString()}`; // Construct URL from command parts
|
|
192
195
|
this.logger.debug(`Connecting to WebSocket URL: ${streamUrl}`);
|
|
193
196
|
this.webSocket = this.webSocketFactory(streamUrl);
|
|
194
197
|
this.setupEventHandlers(); // Sets up handlers that push to internalSubject
|
|
@@ -218,7 +221,10 @@ class WebSocketClient {
|
|
|
218
221
|
// Use potentially overridden base URL in logging
|
|
219
222
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl();
|
|
220
223
|
const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig);
|
|
221
|
-
|
|
224
|
+
const logUrl = baseUrl && pathSegment
|
|
225
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
226
|
+
: "(unknown URL)";
|
|
227
|
+
this.logger.info(`WebSocket connection opened: ${logUrl}`);
|
|
222
228
|
this.reconnectInterval = this.options.reconnectInterval;
|
|
223
229
|
this.reconnectAttempts = 0;
|
|
224
230
|
};
|
|
@@ -257,7 +263,11 @@ class WebSocketClient {
|
|
|
257
263
|
// Use potentially overridden base URL in logging
|
|
258
264
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl();
|
|
259
265
|
const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig);
|
|
260
|
-
|
|
266
|
+
const logUrl = baseUrl && pathSegment
|
|
267
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
268
|
+
: "(unknown URL)";
|
|
269
|
+
this.logger.info(`WebSocket connection closed: ${logUrl} Code [${event.code}], Reason: ${event.reason || "No reason given"}
|
|
270
|
+
. Was open: ${wasOpen}`);
|
|
261
271
|
if (wasOpen && event.code !== 1000 && this.currentCommand) { // Only reconnect if command is still set
|
|
262
272
|
this.attemptReconnect();
|
|
263
273
|
}
|
|
@@ -272,7 +282,10 @@ class WebSocketClient {
|
|
|
272
282
|
// Use potentially overridden base URL in logging
|
|
273
283
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl();
|
|
274
284
|
const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig);
|
|
275
|
-
|
|
285
|
+
const logUrl = baseUrl && pathSegment
|
|
286
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
287
|
+
: "(unknown URL)";
|
|
288
|
+
this.logger.error(`WebSocket encountered an error for stream: ${logUrl}.`);
|
|
276
289
|
if (this.webSocket.readyState !== dntShim.WebSocket.CLOSED &&
|
|
277
290
|
this.webSocket.readyState !== dntShim.WebSocket.CLOSING) {
|
|
278
291
|
this.webSocket.close(1011, "WebSocket error");
|
|
@@ -300,8 +313,11 @@ class WebSocketClient {
|
|
|
300
313
|
// Use potentially overridden base URL
|
|
301
314
|
const baseUrl = this.overrideBaseUrl ?? this.currentCommand.getWebSocketBaseUrl();
|
|
302
315
|
const pathSegment = this.currentCommand.getWebSocketPathSegment(this.currentConfig);
|
|
316
|
+
const logUrl = baseUrl && pathSegment
|
|
317
|
+
? `${baseUrl.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}`
|
|
318
|
+
: "(unknown URL)";
|
|
303
319
|
if (this.options.maxReconnects && this.reconnectAttempts >= this.options.maxReconnects) {
|
|
304
|
-
this.logger.error(`Max reconnect attempts (${this.reconnectAttempts}/${this.options.maxReconnects}) reached. Giving up: ${
|
|
320
|
+
this.logger.error(`Max reconnect attempts (${this.reconnectAttempts}/${this.options.maxReconnects}) reached. Giving up: ${logUrl}`);
|
|
305
321
|
if (!this.internalSubject.closed)
|
|
306
322
|
this.internalSubject.complete();
|
|
307
323
|
this.currentCommand = null;
|
|
@@ -311,7 +327,7 @@ class WebSocketClient {
|
|
|
311
327
|
this.reconnectAttempts++;
|
|
312
328
|
this._isConnecting = true;
|
|
313
329
|
this.logger.info(`Attempting reconnection ${this.reconnectAttempts}${this.options.maxReconnects ? `/${this.options.maxReconnects}` : ""}
|
|
314
|
-
for ${
|
|
330
|
+
for ${logUrl} in ${this.reconnectInterval} ms...`);
|
|
315
331
|
setTimeout(async () => {
|
|
316
332
|
// Check if disconnect was called while waiting
|
|
317
333
|
if (!this.currentCommand || !this.currentConfig) {
|