JS client immediately start->stop->start connection causes Hub event handler added again again #2187

Closed
Xiaohongt opened this Issue Jun 21, 2013 · 2 comments

Projects

None yet

3 participants

@Xiaohongt
Contributor

Functional impact:
In JS client when immediately start->stop->start->stop-> start etc on connection, Hub event handler will be added one more time for each start in this case, e.g. start->stop->start->stop-> start, Hub event handler is added 3 times.

Note, this is regression.

Repro:
1). use the asp.net sample HubConnectionAPI
2). in HubConnectionAPI.js, update start function as below:

    start = function () {
        $.connection.hub.start({ transport: activeTransport, jsonp: isJsonp })
            .done(function () {
                $("<li/>").html("started transport: " + $.connection.hub.transport.name + " " + $.connection.hub.id)
                            .appendTo(messages);

                stopStartBtn.prop("disabled", false)
                            .find("span")
                                .text("Stop Connection")
                                .end()
                            .find("i")
                                .removeClass("icon-play")
                                .addClass("icon-stop");

            });

        $.connection.hub.stop();
        $.connection.hub.start({ transport: activeTransport });
        $.connection.hub.stop();
        $.connection.hub.start({ transport: activeTransport });
    };

3). request HubConnectionAPI/Default.aspx on IE10 for webSockets transport
4). you can see that same connection OnConnected message display 3 times which is that the Hub event handler called 3 times:

   hubConnectionAPI.client.displayMessage = function (value) {
        $("<li/>").html("[" + new Date().toTimeString() + "]: " + value).appendTo(messages);
    }

5). you can also input message and click Broadcast button

Expected result:
message display 1 time

Actual result:
message display 3 times

@NTaylorMullen
Contributor

This is fixed by #2181

@NTaylorMullen NTaylorMullen added a commit that referenced this issue Jun 21, 2013
@NTaylorMullen NTaylorMullen Added test to verify hub event handlers are only triggered once per b…
…inding.

- This is a multi-purpose test to verify 3 bugs.

#2187
#2160
#2190
120eb62
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Jun 22, 2013
@NTaylorMullen NTaylorMullen Added test to verify hub event handlers are only triggered once per b…
…inding.

- This is a multi-purpose test to verify 3 bugs.

#2187
#2160
#2190
e4cf8c6
@Xiaohongt
Contributor

verified

@Xiaohongt Xiaohongt closed this Jun 23, 2013
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 2, 2013
@NTaylorMullen @halter73 NTaylorMullen + halter73 Added test to verify hub event handlers are only triggered once per b…
…inding.

- This is a multi-purpose test to verify 3 bugs.

#2187
#2160
#2190
0e73994
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 2, 2013
@NTaylorMullen @halter73 NTaylorMullen + halter73 Added test to verify hub event handlers are only triggered once per b…
…inding.

- This is a multi-purpose test to verify 3 bugs.

#2187
#2160
#2190
72de4d8
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 7, 2013
@NTaylorMullen @halter73 NTaylorMullen + halter73 Added test to verify hub event handlers are only triggered once per b…
…inding.

- This is a multi-purpose test to verify 3 bugs.

#2187
#2160
#2190
33c2693
@NTaylorMullen NTaylorMullen added a commit that referenced this issue Oct 7, 2013
@NTaylorMullen @halter73 NTaylorMullen + halter73 Added test to verify hub event handlers are only triggered once per b…
…inding.

- This is a multi-purpose test to verify 3 bugs.

#2187
#2160
#2190
6a03c89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment