SignalR JavaScript client sometimes freeze at Connecting or Disconnecting state unexpectedly
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
When calling `hubConnection.start()`, sometimes the client freezes at `Connecting` state, and when calling `hubConnection.stop()`, sometimes the client freezes at `Disconnecting` state. Unless the HubConnection instance is disposed and rebuilt.
### Expected Behavior
Calling `hubConnection.start()` should let the client become `Connected` state as soon as possible, while calling `hubConnection.stop()` should let the client become `Disconnected` state as soon as possible.
### Steps To Reproduce
```ts
import { HubConnection, HubConnectionBuilder, HubConnectionState, LogLevel } from "@microsoft/signalr";
var hubConnection: HubConnection;
hubConnection = new HubConnectionBuilder()
.withUrl("")
.configureLogging(LogLevel.Information)
.withServerTimeout(30000)
.withKeepAliveInterval(15000)
.withStatefulReconnect()
.build();
await hubConnection.start();
function checkIfHubConnected(): boolean {
return hubConnection?.state == HubConnectionState.Connected ?? false;
}
function hubConnectionState() {
return hubConnection?.state;
}
```
### Exceptions (if any)
_No response_
### .NET Version
8.0.7
### Anything else?
package.json
```json
{
"dependencies": {
"@microsoft/signalr": "^8.0.7"
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.