react-signalr
Advanced tools
Comparing version
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.2.22](https://github.com/hosseinmd/react-signalr/compare/v0.2.21...v0.2.22) (2024-05-26) | ||
### Features | ||
* add retyrDelay to automaticReconnect ([93b43b1](https://github.com/hosseinmd/react-signalr/commit/93b43b1fab2860da85702ed2723d8ec113561015)) | ||
### [0.2.21](https://github.com/hosseinmd/react-signalr/compare/v0.2.20...v0.2.21) (2024-05-26) | ||
@@ -7,0 +14,0 @@ |
@@ -14,4 +14,9 @@ import { HubConnection, IHttpConnectionOptions } from "@microsoft/signalr"; | ||
onReconnect?: (connection: HubConnection) => void; | ||
automaticReconnect?: boolean; | ||
/** Configures the {@link @microsoft/signalr.HubConnection} to automatically attempt to reconnect if the connection is lost. | ||
* | ||
* `number[]` retryDelays An array containing the delays in milliseconds before trying each reconnect attempt. | ||
* The length of the array represents how many failed reconnect attempts it takes before the client will stop attempting to reconnect. | ||
*/ | ||
automaticReconnect?: boolean | number[]; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
import { HubConnection, IHttpConnectionOptions } from "@microsoft/signalr"; | ||
declare function isConnectionConnecting(connection: HubConnection): boolean; | ||
declare function createConnection(url: string, transportType: IHttpConnectionOptions, automaticReconnect?: boolean): HubConnection; | ||
declare function createConnection(url: string, transportType: IHttpConnectionOptions, automaticReconnect?: boolean | number[]): HubConnection; | ||
export { isConnectionConnecting, createConnection }; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -14,3 +14,9 @@ "use strict"; | ||
if (automaticReconnect) { | ||
connectionBuilder = connectionBuilder.withAutomaticReconnect(); | ||
if (Array.isArray(automaticReconnect)) { | ||
connectionBuilder = | ||
connectionBuilder.withAutomaticReconnect(automaticReconnect); | ||
} | ||
else { | ||
connectionBuilder = connectionBuilder.withAutomaticReconnect(); | ||
} | ||
} | ||
@@ -17,0 +23,0 @@ if (transportType.logger) { |
{ | ||
"name": "react-signalr", | ||
"version": "0.2.21", | ||
"version": "0.2.22", | ||
"description": "React-signalr is a tools for using signalr web socket in react/react-native apps", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -15,3 +15,8 @@ import { HubConnection, IHttpConnectionOptions } from "@microsoft/signalr"; | ||
onReconnect?: (connection: HubConnection) => void; | ||
automaticReconnect?: boolean; | ||
/** Configures the {@link @microsoft/signalr.HubConnection} to automatically attempt to reconnect if the connection is lost. | ||
* | ||
* `number[]` retryDelays An array containing the delays in milliseconds before trying each reconnect attempt. | ||
* The length of the array represents how many failed reconnect attempts it takes before the client will stop attempting to reconnect. | ||
*/ | ||
automaticReconnect?: boolean | number[]; | ||
} |
@@ -19,3 +19,3 @@ import { | ||
transportType: IHttpConnectionOptions, | ||
automaticReconnect = true, | ||
automaticReconnect: boolean | number[] = true, | ||
) { | ||
@@ -28,3 +28,8 @@ let connectionBuilder = new HubConnectionBuilder().withUrl( | ||
if (automaticReconnect) { | ||
connectionBuilder = connectionBuilder.withAutomaticReconnect(); | ||
if (Array.isArray(automaticReconnect)) { | ||
connectionBuilder = | ||
connectionBuilder.withAutomaticReconnect(automaticReconnect); | ||
} else { | ||
connectionBuilder = connectionBuilder.withAutomaticReconnect(); | ||
} | ||
} | ||
@@ -31,0 +36,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
346428
0.47%3203
0.66%