@exhumer/signalr-client 1.0.0 → 1.0.1
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/README.md +6 -1
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -7
- package/dist/index.d.ts +14 -7
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
package/dist/index.d.cts
CHANGED
|
@@ -507,6 +507,11 @@ interface HubConnectionOptions {
|
|
|
507
507
|
readonly skipNegotiation?: boolean;
|
|
508
508
|
readonly serverTimeoutInMilliseconds?: number;
|
|
509
509
|
readonly keepAliveIntervalInMilliseconds?: number;
|
|
510
|
+
/**
|
|
511
|
+
* Override the SignalR handshake timeout (ms). Defaults to 15 000.
|
|
512
|
+
* Intended for testing; production code should leave this at the default.
|
|
513
|
+
*/
|
|
514
|
+
readonly handshakeTimeoutInMilliseconds?: number;
|
|
510
515
|
readonly reconnectPolicy?: IRetryPolicy | null;
|
|
511
516
|
/**
|
|
512
517
|
* undici Dispatcher shared by all HTTP requests (negotiate, SSE, polling)
|
|
@@ -616,6 +621,8 @@ interface UrlOptions {
|
|
|
616
621
|
readonly serverTimeoutInMilliseconds?: number;
|
|
617
622
|
/** ms between keep-alive pings (default: 15 000). */
|
|
618
623
|
readonly keepAliveIntervalInMilliseconds?: number;
|
|
624
|
+
/** ms to wait for the SignalR handshake response (default: 15 000). */
|
|
625
|
+
readonly handshakeTimeoutInMilliseconds?: number;
|
|
619
626
|
}
|
|
620
627
|
declare class HubConnectionBuilder {
|
|
621
628
|
#private;
|
|
@@ -1018,13 +1025,13 @@ declare class LongPollingTransport implements ITransport {
|
|
|
1018
1025
|
* Typed EventEmitter via interface declaration merging.
|
|
1019
1026
|
*
|
|
1020
1027
|
* Emitted events
|
|
1021
|
-
* 'open'
|
|
1022
|
-
* 'message' (string)
|
|
1023
|
-
* 'binary' (Buffer)
|
|
1024
|
-
* 'ping' (Buffer)
|
|
1025
|
-
* 'pong' (Buffer)
|
|
1026
|
-
* 'close'
|
|
1027
|
-
* 'error' (Error)
|
|
1028
|
+
* 'open' - handshake complete, ready to send/receive
|
|
1029
|
+
* 'message' (string) - UTF-8 text frame received
|
|
1030
|
+
* 'binary' (Buffer) - binary frame received
|
|
1031
|
+
* 'ping' (Buffer) - ping frame received (pong sent automatically)
|
|
1032
|
+
* 'pong' (Buffer) - pong frame received
|
|
1033
|
+
* 'close' - socket fully closed
|
|
1034
|
+
* 'error' (Error) - socket-level error
|
|
1028
1035
|
*/
|
|
1029
1036
|
|
|
1030
1037
|
declare const enum WebSocketReadyState {
|
package/dist/index.d.ts
CHANGED
|
@@ -507,6 +507,11 @@ interface HubConnectionOptions {
|
|
|
507
507
|
readonly skipNegotiation?: boolean;
|
|
508
508
|
readonly serverTimeoutInMilliseconds?: number;
|
|
509
509
|
readonly keepAliveIntervalInMilliseconds?: number;
|
|
510
|
+
/**
|
|
511
|
+
* Override the SignalR handshake timeout (ms). Defaults to 15 000.
|
|
512
|
+
* Intended for testing; production code should leave this at the default.
|
|
513
|
+
*/
|
|
514
|
+
readonly handshakeTimeoutInMilliseconds?: number;
|
|
510
515
|
readonly reconnectPolicy?: IRetryPolicy | null;
|
|
511
516
|
/**
|
|
512
517
|
* undici Dispatcher shared by all HTTP requests (negotiate, SSE, polling)
|
|
@@ -616,6 +621,8 @@ interface UrlOptions {
|
|
|
616
621
|
readonly serverTimeoutInMilliseconds?: number;
|
|
617
622
|
/** ms between keep-alive pings (default: 15 000). */
|
|
618
623
|
readonly keepAliveIntervalInMilliseconds?: number;
|
|
624
|
+
/** ms to wait for the SignalR handshake response (default: 15 000). */
|
|
625
|
+
readonly handshakeTimeoutInMilliseconds?: number;
|
|
619
626
|
}
|
|
620
627
|
declare class HubConnectionBuilder {
|
|
621
628
|
#private;
|
|
@@ -1018,13 +1025,13 @@ declare class LongPollingTransport implements ITransport {
|
|
|
1018
1025
|
* Typed EventEmitter via interface declaration merging.
|
|
1019
1026
|
*
|
|
1020
1027
|
* Emitted events
|
|
1021
|
-
* 'open'
|
|
1022
|
-
* 'message' (string)
|
|
1023
|
-
* 'binary' (Buffer)
|
|
1024
|
-
* 'ping' (Buffer)
|
|
1025
|
-
* 'pong' (Buffer)
|
|
1026
|
-
* 'close'
|
|
1027
|
-
* 'error' (Error)
|
|
1028
|
+
* 'open' - handshake complete, ready to send/receive
|
|
1029
|
+
* 'message' (string) - UTF-8 text frame received
|
|
1030
|
+
* 'binary' (Buffer) - binary frame received
|
|
1031
|
+
* 'ping' (Buffer) - ping frame received (pong sent automatically)
|
|
1032
|
+
* 'pong' (Buffer) - pong frame received
|
|
1033
|
+
* 'close' - socket fully closed
|
|
1034
|
+
* 'error' (Error) - socket-level error
|
|
1028
1035
|
*/
|
|
1029
1036
|
|
|
1030
1037
|
declare const enum WebSocketReadyState {
|
package/dist/index.js
CHANGED
|
@@ -254,7 +254,7 @@ var StreamHttpClient = class extends BaseUndiciClient {
|
|
|
254
254
|
return pt;
|
|
255
255
|
}
|
|
256
256
|
).catch((err) => {
|
|
257
|
-
pt.destroy(
|
|
257
|
+
pt.destroy();
|
|
258
258
|
reject(err);
|
|
259
259
|
});
|
|
260
260
|
});
|
|
@@ -436,8 +436,13 @@ var DispatchHttpClient = class extends BaseUndiciClient {
|
|
|
436
436
|
controller = ctrl;
|
|
437
437
|
},
|
|
438
438
|
onResponseError: (_ctrl, err) => {
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
if (!resolved) {
|
|
440
|
+
resolved = true;
|
|
441
|
+
pt.destroy();
|
|
442
|
+
reject(err);
|
|
443
|
+
} else {
|
|
444
|
+
pt.destroy(err);
|
|
445
|
+
}
|
|
441
446
|
},
|
|
442
447
|
onResponseStart: (_ctrl, statusCode, headers2) => {
|
|
443
448
|
if (!resolved) {
|
|
@@ -1240,6 +1245,7 @@ var HubConnection = class {
|
|
|
1240
1245
|
#skipNegotiation;
|
|
1241
1246
|
#serverTimeout;
|
|
1242
1247
|
#pingInterval;
|
|
1248
|
+
#handshakeTimeout;
|
|
1243
1249
|
#reconnectPolicy;
|
|
1244
1250
|
#protocol;
|
|
1245
1251
|
#http;
|
|
@@ -1277,6 +1283,7 @@ var HubConnection = class {
|
|
|
1277
1283
|
this.#skipNegotiation = options.skipNegotiation ?? false;
|
|
1278
1284
|
this.#serverTimeout = options.serverTimeoutInMilliseconds ?? DEFAULT_SERVER_TIMEOUT_IN_MS;
|
|
1279
1285
|
this.#pingInterval = options.keepAliveIntervalInMilliseconds ?? DEFAULT_PING_INTERVAL_IN_MS;
|
|
1286
|
+
this.#handshakeTimeout = options.handshakeTimeoutInMilliseconds ?? 15e3;
|
|
1280
1287
|
this.#reconnectPolicy = options.reconnectPolicy ?? null;
|
|
1281
1288
|
this.#protocol = new JsonHubProtocol();
|
|
1282
1289
|
this.#dispatcher = options.dispatcher;
|
|
@@ -1550,6 +1557,7 @@ var HubConnection = class {
|
|
|
1550
1557
|
return new ServerSentEventsTransport(this.#http, factory, this.#logger, headers);
|
|
1551
1558
|
case HttpTransportType.LongPolling:
|
|
1552
1559
|
return new LongPollingTransport(this.#http, factory, this.#logger, headers);
|
|
1560
|
+
/* istanbul ignore next */
|
|
1553
1561
|
default:
|
|
1554
1562
|
throw new UnsupportedTransportError(`Unknown transport type: ${type}`, type);
|
|
1555
1563
|
}
|
|
@@ -1562,7 +1570,7 @@ var HubConnection = class {
|
|
|
1562
1570
|
this.#transport.send(HANDSHAKE_REQUEST).catch(reject);
|
|
1563
1571
|
this.#handshakeTimer = setTimeout(() => {
|
|
1564
1572
|
reject(new Error("Server timeout: no handshake response received."));
|
|
1565
|
-
},
|
|
1573
|
+
}, this.#handshakeTimeout);
|
|
1566
1574
|
});
|
|
1567
1575
|
}
|
|
1568
1576
|
// ─── Internal: incoming data ─────────────────────────────────────────────
|
|
@@ -1988,6 +1996,7 @@ var HubConnectionBuilder = class {
|
|
|
1988
1996
|
...this.#urlOptions.skipNegotiation != null && { skipNegotiation: this.#urlOptions.skipNegotiation },
|
|
1989
1997
|
...this.#urlOptions.serverTimeoutInMilliseconds != null && { serverTimeoutInMilliseconds: this.#urlOptions.serverTimeoutInMilliseconds },
|
|
1990
1998
|
...this.#urlOptions.keepAliveIntervalInMilliseconds != null && { keepAliveIntervalInMilliseconds: this.#urlOptions.keepAliveIntervalInMilliseconds },
|
|
1999
|
+
...this.#urlOptions.handshakeTimeoutInMilliseconds != null && { handshakeTimeoutInMilliseconds: this.#urlOptions.handshakeTimeoutInMilliseconds },
|
|
1991
2000
|
...this.#reconnectPolicy != null && { reconnectPolicy: this.#reconnectPolicy },
|
|
1992
2001
|
...effectiveDispatcher != null && { dispatcher: effectiveDispatcher },
|
|
1993
2002
|
...this.#httpClient != null && { httpClient: this.#httpClient }
|