Skip to content

In JS client disconnected event connection state is still connected #2554

Closed
Xiaohongt opened this Issue Sep 16, 2013 · 3 comments

4 participants

@Xiaohongt
SignalR member

In JS client disconnected event connection state is still connected

Functional impact:
incorrect connection state when it is disconnected

Note, it is not regression.

Repro steps:
1). use AspNet.SignalR.Samples, in HubConnectionAPI.js disconnected event add log for $.connection.hub.state:

    $.connection.hub.disconnected(function () {
        window.console.log("$.connection.hub.state: " + $.connection.hub.state);
        .......
       });

2). request Hubs/HubConnectionAPI/Default.aspx
3). on page, after connected, click "Stop Connection"
4). look the log

Actual result:
in disconnected event connection state is still connected

Expected:
in disconnected event connection state is disconnected

@davidfowl
SignalR member

@NTaylorMullen Can you see if this repros. If so we want to fix in 2.0.1 and 1.1.5.

@NTaylorMullen

Yup this repros and is a super obvious fix. will port to both

@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 21, 2013
@NTaylorMullen NTaylorMullen Altered when we transition into the disconnected state during connect…
…ion.stop.

- This ensures that when the disconnected handler is called that we're in the disconnected state.
- Removed the try -> finally for this transition because the state transition now occurs prior to anything that would throw.
- Added a simple unit test to ensure that disconnected is triggered while in the disconnected state.

#2554
bdd2ccd
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 24, 2013
@NTaylorMullen NTaylorMullen Altered when we transition into the disconnected state during connect…
…ion.stop.

- This ensures that when the disconnected handler is called that we're in the disconnected state.
- Removed the try -> finally for this transition because the state transition now occurs prior to anything that would throw.
- Added a simple unit test to ensure that disconnected is triggered while in the disconnected state.

#2554
e06f330
@gustavo-armenta

tested disconnected event is raised with connection.state==disconnected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.