@exhumer/signalr-client 1.0.0 → 1.0.2
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 +10 -7
package/README.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# @exhumer/signalr-client
|
|
2
2
|
|
|
3
|
+
[](https://github.com/eXhumer/signalr-client-ts/actions/workflows/ci.yml)
|
|
4
|
+
[](https://codecov.io/gh/eXhumer/signalr-client-ts)
|
|
5
|
+
[](https://www.npmjs.com/package/@exhumer/signalr-client)
|
|
6
|
+
|
|
7
|
+
|
|
3
8
|
ASP.NET Core SignalR client for Node.js. HTTP and WebSocket layers are backed entirely by [undici](https://github.com/nodejs/undici) - no `node-fetch`, no `ws`, no browser shims required.
|
|
4
9
|
|
|
5
10
|
## Requirements
|
|
6
11
|
|
|
7
|
-
- Node.js ≥
|
|
12
|
+
- Node.js ≥ 22
|
|
8
13
|
- TypeScript ≥ 5.9 (for consumers using types)
|
|
9
14
|
|
|
10
15
|
## Installation
|
package/dist/index.cjs
CHANGED
|
@@ -334,7 +334,7 @@ var StreamHttpClient = class extends BaseUndiciClient {
|
|
|
334
334
|
return pt;
|
|
335
335
|
}
|
|
336
336
|
).catch((err) => {
|
|
337
|
-
pt.destroy(
|
|
337
|
+
pt.destroy();
|
|
338
338
|
reject(err);
|
|
339
339
|
});
|
|
340
340
|
});
|
|
@@ -516,8 +516,13 @@ var DispatchHttpClient = class extends BaseUndiciClient {
|
|
|
516
516
|
controller = ctrl;
|
|
517
517
|
},
|
|
518
518
|
onResponseError: (_ctrl, err) => {
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
if (!resolved) {
|
|
520
|
+
resolved = true;
|
|
521
|
+
pt.destroy();
|
|
522
|
+
reject(err);
|
|
523
|
+
} else {
|
|
524
|
+
pt.destroy(err);
|
|
525
|
+
}
|
|
521
526
|
},
|
|
522
527
|
onResponseStart: (_ctrl, statusCode, headers2) => {
|
|
523
528
|
if (!resolved) {
|
|
@@ -1320,6 +1325,7 @@ var HubConnection = class {
|
|
|
1320
1325
|
#skipNegotiation;
|
|
1321
1326
|
#serverTimeout;
|
|
1322
1327
|
#pingInterval;
|
|
1328
|
+
#handshakeTimeout;
|
|
1323
1329
|
#reconnectPolicy;
|
|
1324
1330
|
#protocol;
|
|
1325
1331
|
#http;
|
|
@@ -1357,6 +1363,7 @@ var HubConnection = class {
|
|
|
1357
1363
|
this.#skipNegotiation = options.skipNegotiation ?? false;
|
|
1358
1364
|
this.#serverTimeout = options.serverTimeoutInMilliseconds ?? DEFAULT_SERVER_TIMEOUT_IN_MS;
|
|
1359
1365
|
this.#pingInterval = options.keepAliveIntervalInMilliseconds ?? DEFAULT_PING_INTERVAL_IN_MS;
|
|
1366
|
+
this.#handshakeTimeout = options.handshakeTimeoutInMilliseconds ?? 15e3;
|
|
1360
1367
|
this.#reconnectPolicy = options.reconnectPolicy ?? null;
|
|
1361
1368
|
this.#protocol = new JsonHubProtocol();
|
|
1362
1369
|
this.#dispatcher = options.dispatcher;
|
|
@@ -1630,6 +1637,7 @@ var HubConnection = class {
|
|
|
1630
1637
|
return new ServerSentEventsTransport(this.#http, factory, this.#logger, headers);
|
|
1631
1638
|
case HttpTransportType.LongPolling:
|
|
1632
1639
|
return new LongPollingTransport(this.#http, factory, this.#logger, headers);
|
|
1640
|
+
/* istanbul ignore next */
|
|
1633
1641
|
default:
|
|
1634
1642
|
throw new UnsupportedTransportError(`Unknown transport type: ${type}`, type);
|
|
1635
1643
|
}
|
|
@@ -1642,7 +1650,7 @@ var HubConnection = class {
|
|
|
1642
1650
|
this.#transport.send(HANDSHAKE_REQUEST).catch(reject);
|
|
1643
1651
|
this.#handshakeTimer = setTimeout(() => {
|
|
1644
1652
|
reject(new Error("Server timeout: no handshake response received."));
|
|
1645
|
-
},
|
|
1653
|
+
}, this.#handshakeTimeout);
|
|
1646
1654
|
});
|
|
1647
1655
|
}
|
|
1648
1656
|
// ─── Internal: incoming data ─────────────────────────────────────────────
|
|
@@ -2068,6 +2076,7 @@ var HubConnectionBuilder = class {
|
|
|
2068
2076
|
...this.#urlOptions.skipNegotiation != null && { skipNegotiation: this.#urlOptions.skipNegotiation },
|
|
2069
2077
|
...this.#urlOptions.serverTimeoutInMilliseconds != null && { serverTimeoutInMilliseconds: this.#urlOptions.serverTimeoutInMilliseconds },
|
|
2070
2078
|
...this.#urlOptions.keepAliveIntervalInMilliseconds != null && { keepAliveIntervalInMilliseconds: this.#urlOptions.keepAliveIntervalInMilliseconds },
|
|
2079
|
+
...this.#urlOptions.handshakeTimeoutInMilliseconds != null && { handshakeTimeoutInMilliseconds: this.#urlOptions.handshakeTimeoutInMilliseconds },
|
|
2071
2080
|
...this.#reconnectPolicy != null && { reconnectPolicy: this.#reconnectPolicy },
|
|
2072
2081
|
...effectiveDispatcher != null && { dispatcher: effectiveDispatcher },
|
|
2073
2082
|
...this.#httpClient != null && { httpClient: this.#httpClient }
|