JavaScript Client does not cause OnReconnected event to fire when using longPolling transport #2501

halter73 opened this Issue Sep 5, 2013 · 1 comment


None yet
4 participants

halter73 commented Sep 5, 2013

To reproduce


    var proxy = $.connection.chatHub;
    proxy.client.logMessage = function (message) {

    $.connection.hub.logging = true;
    $.connection.hub.connectionSlow(function () {
        console.log('We are currently experiencing difficulties with the connection.')
    $.connection.hub.error(function (error) {
        console.log('SignalR error: ' + error)
    $.connection.hub.start({ transport: 'longPolling' }).done(function () {


public class ChatHub : Hub

    public override Task OnConnected()
        return base.OnConnected();

    public override Task OnDisconnected()
        return base.OnDisconnected();

    public override Task OnReconnected()
        return base.OnReconnected();

If I don't specify transport, foreverFrame is used. Connection is successfully established and console shows "Connected" message. If I recycle app pool manually or cause the recycle by modifying web.config, console shows "Reconnected" message, indicating that OnReconnected method of the hub was fired.
But if I specify longPolling as my transport, after the initial load console shows "Connected" message. However, when I cause app pool recycle, "Reconnected" message never shows up. Console just keeps logging SignalR: Attempting to connect to '' using longPolling every 110 seconds.

How should I restore connection to the server? Does the client know when there's no hub listening on the server side so that I can restart connection by $.connection.hub.start()?


@abnanda1 abnanda1 added a commit that referenced this issue Oct 8, 2013

@abnanda1 abnanda1 Fixed code analysis errors ef5b438

gustavo-armenta commented Oct 21, 2013

tested OnReconnected fires on long polling

•[15:00:10 GMT-0700 (Pacific Daylight Time)]: connecting => connected 12f50802-994c-4052-b788-7961ec7bbbc6
•started transport: longPolling 12f50802-994c-4052-b788-7961ec7bbbc6
•[15:00:40 GMT-0700 (Pacific Daylight Time)]: connected => reconnecting 12f50802-994c-4052-b788-7961ec7bbbc6
•[15:00:48 GMT-0700 (Pacific Daylight Time)]: reconnecting => connected 12f50802-994c-4052-b788-7961ec7bbbc6
•[15:00:48 GMT-0700 (Pacific Daylight Time)]: 12f50802-994c-4052-b788-7961ec7bbbc6 OnReconnected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment